Results 1 to 28 of 28

Thread: Problem in dropdown inside updatepanel

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2007
    Posts
    241

    Thumbs up Problem in dropdown inside updatepanel

    Hi,

    I am using Asp.Net 3.5. I am having two problems in dropdown inside the update panel. I have two drop down list. First dropdown i loaded the data from db. Its working fine. Once i changed the data using SelectedIndexChange event it's firing first time(i put AutoPostback="true") if i click multiple times for multiple data it's not fired. If changed the value i bind the data to another dropdown list. But it is not binding. My control is inside the update panel. What is the problem? i came across multiple site and try it.But no use? Its very urgent. I put the code here.

    //////////// HTML Source Code/////////////////////////
    Code:
    <form id="MAppNHSTDAfrm" runat="server">
        <telerik:RadScriptManager ID="RdScptMgrMAppNHSTDAfrm" EnablePartialRendering="true"
            AsyncPostBackTimeout="36000" runat="server">
        </telerik:RadScriptManager>
        <telerik:RadStyleSheetManager ID="RdStyMgrMAppNHSTDAfrm" EnableStyleSheetCombine="true"
            runat="server">
        </telerik:RadStyleSheetManager>
        <div class="contentcontainer">
            <fieldset style="width: 98&#37;; height: 93%">
                <asp:UpdatePanel ID="uPnlProgramDetails" runat="server" UpdateMode="Conditional">
                    <ContentTemplate>
                        <table border="0" cellpadding="3" cellspacing="2" style="width: 100%;">
                            <tr>
                               <td id="Td7" runat="server">
                                                    Branch :&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                   
                                                   <asp:DropDownList ID="uxBranch" runat="server"  AutoPostBack = "true"
                                                        onselectedindexchanged="uxBranch_SelectedIndexChanged">
                                                   </asp:DropDownList>
                                                </td>
                                                
                                                <td id="Td8" runat="server" class="datafield">
                                                Trust :&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                
                                                <asp:DropDownList ID="uxTrust" runat="server">
                                                </asp:DropDownList>
                                                </td>
    </tr>
    </table>
      </ContentTemplate>
                    <%--<Triggers>
                  <%--<asp:AsyncPostBackTrigger ControlID="TypeOfApplicationDropDown" /> --%>
                  <asp:AsyncPostBackTrigger ControlID="uxBranch" EventName="SelectedIndexChanged" />
                </Triggers>--%>
                </asp:UpdatePanel>
            </fieldset>
        </div>
        </form>
    ///////Code behind///////////////////
    Code:
    protected override void Page_Load(object sender, EventArgs e)
            {
               if (!Page.IsPostBack)
                {
                        FillDropDown();
                }
            }
      protected void FillDropDown()
            {
                FillForBranch();
             }
    //Fill data for first drop down when page load
    
               protected void FillForBranch()
            {
                try
                {
                    ResultBE result;
                    DataTable lookUpTable = new DataTable();
                    lookUpReference = new LovValueBLL();
                    lookUpTable = lookUpReference.GetLovValue(27, "%", out result);
                    uxBranch.DataTextField = "ValueDesc";
                    uxBranch.DataValueField = "ID";
                    uxBranch.DataSource = lookUpTable;
                    uxBranch.DataBind();
                    AddSelect(uxBranch);
                    //uxBranch.SelectedIndex = 0;
                }
                catch (Exception ex)
                {
                    ex.ToString();
                }
            }
    
    // select changed the value from the first dropdown and load in other drop down
    protected void uxBranch_SelectedIndexChanged(object sender, EventArgs e)
                {
                    if (uxBranch.SelectedValue == "1738")
                    {
                        FillForBranchAdult();
                     }
                    if (uxBranch.SelectedValue == "1739")
                    {
                        FillForBranchChild();
                    }
                    if (uxBranch.SelectedValue == "1740")
                    {
                        FillForBranchMentalHealth();
                    }
                }
    
      protected void FillForBranchAdult()
            {
                try
                {
                    ResultBE result;
                    DataTable lookUpTable = new DataTable();
                    lookUpReference = new LovValueBLL();
                    lookUpTable = lookUpReference.GetLovValue(24, "%", out result);
                    uxTrust.DataTextField = "ValueDesc";
                    uxTrust.DataValueField = "ID";
                    uxTrust.DataSource = lookUpTable;
                    uxTrust.DataBind();
                    //uPnlProgramDetails.Update();
                    AddSelect(uxTrust);
                    
                }
                catch (Exception ex)
                {
                    ex.ToString();
                }
            }
    Hope your's reply.

    Thanks
    Last edited by Guvera; Sep 15th, 2010 at 04:52 AM.
    Failing to plan is Planning to fail

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width