DropDownLists在WebForms的ajaxtoolkit tabpanel中自动设置值

时间:2019-01-18 12:33:54

标签: asp.net webforms dropdown ajaxcontroltoolkit

我正在使用AjaxToolKit选项卡面板,其中制作了4个选项卡,所有选项卡都有一些下拉列表,这些下拉列表是我从数据库加载的。 现在,当我要设置值1 DropDown时,所有其他DropDowns设置值都会自动设置。

  

这是我仅设置一个DropDown的代码

private void LoadDDLs()
        {
            DataTable dt = SysFunc.GetData("Select * from AccountCodeSetup where DealerCode = '" + Session["DealerCode"].ToString() + "'");

            ddlExPartCostMkt.SelectedValue = dt.Rows[0]["PartsCostofSales(Market)"].ToString().Trim();
            //ddlExPartCostCKD.SelectedValue =    dt.Rows[0]["PartsCostofSales(CKD)"].ToString().Trim();
            //ddlExPartCostLcl.SelectedValue =    dt.Rows[0]["PartsCostofSales(Local)"].ToString().Trim();
            //ddlExLubCostMkt.SelectedValue =     dt.Rows[0]["LubricantCostofSales(Market)"].ToString().Trim();
            //ddlExLubCostLcl.SelectedValue =     dt.Rows[0]["LubricantCostofSales(Local)"].ToString().Trim();
            //ddlExCashDis.SelectedValue =        dt.Rows[0]["CashDiscountTaken"].ToString().Trim();
            //ddlExChargeOut.SelectedValue =      dt.Rows[0]["ChargeOutAccount"].ToString().Trim();
            //ddlExBadDate.SelectedValue =        dt.Rows[0]["baddebts"].ToString().Trim();

            //ddlInPartSaleMkt.SelectedValue =    dt.Rows[0]["PartsSaleIncome(Market)"].ToString().Trim();
            //ddlInPartSaleCKD.SelectedValue =    dt.Rows[0]["PartsSaleIncome(CKD)"].ToString().Trim();
            //ddlInPartSaleLcl.SelectedValue =    dt.Rows[0]["PartsSaleIncome(Local)"].ToString().Trim();
            //ddlInLubSaleMkt.SelectedValue =     dt.Rows[0]["LubricnatSaleIncome(Market)"].ToString().Trim();
            //ddlInLubSaleLcl.SelectedValue =     dt.Rows[0]["LubricnatSaleIncome(Local)"].ToString().Trim();
            //ddlInSubIncome.SelectedValue =      dt.Rows[0]["SubletIncome)"].ToString().Trim();
            //ddlInLabIncome.SelectedValue =      dt.Rows[0]["LabourIncome)"].ToString().Trim();
            //ddlInWarantyLab.SelectedValue =     dt.Rows[0]["WarrantyLabour)"].ToString().Trim();

            //ddlAssPartStkLcl.SelectedValue =    dt.Rows[0]["PartsStock(Local)"].ToString().Trim();
            //ddlAssPartStkMkt.SelectedValue =    dt.Rows[0]["PartsStock(Market)"].ToString().Trim();
            //ddlAssPartStkCKD.SelectedValue =    dt.Rows[0]["PartsStock(CKD)"].ToString().Trim();
            //ddlAssLubStkMkt.SelectedValue =     dt.Rows[0]["LubricantStock(Market)"].ToString().Trim();

            //ddlLiabPST.SelectedValue =          dt.Rows[0]["PSTAccount"].ToString().Trim();
            //ddlLiabGST.SelectedValue =          dt.Rows[0]["GSTAccount"].ToString().Trim();
            //ddlLiabExtra.SelectedValue =        dt.Rows[0]["OtherTax"].ToString().Trim();
            //ddlLiabFur.SelectedValue =          dt.Rows[0][""].ToString().Trim();
            //ddlLiabWithHold.SelectedValue =     dt.Rows[0]["WHTax5"].ToString().Trim();

        }
  

但是我得到的输出是这个

Output is here

  

这是第一个标签的设计代码

<ajaxToolkit:TabContainer ID="TabContainer1" runat="server"  CssClass="TabStyle" TabIndex="20" Width="100%" Style="direction: ltr; text-align: left; display: grid;">
                <ajaxToolkit:TabPanel ID="TabPanel1" runat="server">
                    <HeaderTemplate>Expense</HeaderTemplate>
                    <ContentTemplate >                           
                            <table width="100%" class="table table-bordered table-hover">
                                <tr>
                                    <td style="width:20%;">Parts Cost of Sales (Market)</td>
                                    <td style="width:30%;"><asp:DropDownList runat="server" ID="ddlExPartCostMkt"></asp:DropDownList></td>
                                    <td style="width:20%;">Parts Cost of Sales (CKD)</td>
                                    <td style="width:30%;"><asp:DropDownList runat="server" ID="ddlExPartCostCKD"></asp:DropDownList></td>
                                </tr>
                                <tr>
                                    <td>Parts Cost of Sales (Local)</td>
                                    <td><asp:DropDownList runat="server" ID="ddlExPartCostLcl"></asp:DropDownList></td>
                                    <td>Lubricant Cost of Sales (Market)</td>
                                    <td><asp:DropDownList runat="server" ID="ddlExLubCostMkt"></asp:DropDownList></td>
                                </tr>
                                <tr>
                                    <td>Lubricant Cost of Sales (Local)</td>
                                    <td><asp:DropDownList runat="server" ID="ddlExLubCostLcl"></asp:DropDownList></td>
                                    <td>Cash Discount</td>
                                    <td><asp:DropDownList runat="server" ID="ddlExCashDis"></asp:DropDownList></td>
                                </tr>
                                <tr>
                                    <td>ChargeOut</td>
                                    <td><asp:DropDownList runat="server" ID="ddlExChargeOut"></asp:DropDownList></td>
                                    <td>bad date</td>
                                    <td><asp:DropDownList runat="server" ID="ddlExBadDate"></asp:DropDownList></td>
                                </tr>
                            </table>
                     </ContentTemplate>
                </ajaxToolkit:TabPanel>

有人可以告诉我我做错了什么吗?它的WebForm项目和表单在MasterPage中,而我也在UpdatePanel中工作。

0 个答案:

没有答案