Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I have one drop down which is in UpdatePanel on click on dropdown it is firing selectedIndexchange event in which it has to visible the Placeholers for Users.

which is not happening. dropdown event is firing but it is not updating the Place holeders.. I have tried alot with updatemode, childeren as Triggers.. Please help me in resolving this ?




XML
<asp:UpdatePanel id="regionPanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
                  <ContentTemplate>
                      <asp:DropDownList ID="ddlLicenseType" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlLicenseType_SelectedIndexChanged1">
                          <asp:ListItem Text="Select"></asp:ListItem>
                          <asp:ListItem Text="ABB Global License"></asp:ListItem>
                          <asp:ListItem Text="Local Purchase"></asp:ListItem>
                          <asp:ListItem Text="Others"></asp:ListItem>
                      </asp:DropDownList>
                      <asp:RequiredFieldValidator ID="RequiredFieldValidator6" CssClass="ErrMsg" ForeColor=" "
                          ValidationGroup="save" ControlToValidate="ddlLicenseType" runat="server" Display="dynamic"
                          ErrorMessage="<BR>  Select License Type" InitialValue="Select"></asp:RequiredFieldValidator>
                </ContentTemplate>
                            <Triggers>
                      <asp:AsyncPostBackTrigger ControlID="ddlLicenseType" EventName="SelectedIndexChanged" />
                  </Triggers>
              </asp:UpdatePanel>



------------------------------------------------------------------------------
Background Code:

CSS
protected void ddlLicenseType_SelectedIndexChanged1(object sender, EventArgs e)
    {
        if (ddlLicenseType.SelectedIndex == 1)
        {
            ddlLicenseType.Enabled = false;
            grdSoftwareListGlobal.Dispose();
            plsSoftwareLicenseLocal.Visible = false;
            PlaceHolderGlobal.Visible = true;
            PlaceHolderLocal.Visible = false;
            lblGPrice.Text = string.Empty;
            PlaceHolderLocalOther.Visible = false;
            ddlProductCategory.DataSource = objMgr.getCategoryLocalGlobal("Global");
            ddlProductCategory.DataTextField = "prod_category";
            ddlProductCategory.DataValueField = "prod_category";
            ddlProductCategory.DataBind();
            ddlProductCategory.Items.Insert(0, new ListItem("Select", ""));
            ddlProductCategory.SelectedIndex = 0;
            plsSoftwareDetailsGlobal.Visible = true;
            plsSoftwareDetailsLocal.Visible = false;
------------------------------------------------------------------------------


<pre lang="xml">&lt;asp:PlaceHolder ID=&quot;PlaceHolderGlobal&quot; Visible=&quot;true&quot; runat=&quot;server&quot;&gt;

         &lt;tr&gt;
             &lt;td&gt;
                 &lt;asp:Label ID=&quot;lblProductCategory&quot; runat=&quot;server&quot; Text=&quot;Category&quot;&gt;&lt;/asp:Label&gt;
                 &lt;asp:Label ID=&quot;Label12&quot; runat=&quot;server&quot; Text=&quot;*&quot; CssClass=&quot;mandatory&quot; /&gt;
             &lt;/td&gt;
             &lt;td nowrap&gt;
                 &lt;asp:DropDownList ID=&quot;ddlProductCategory&quot; runat=&quot;server&quot; AutoPostBack=&quot;True&quot; OnSelectedIndexChanged=&quot;ddlProductCategory_SelectedIndexChanged&quot;&gt;
                 &lt;/asp:DropDownList&gt;
                 &lt;%--&lt;asp:RequiredFieldValidator ID=&quot;RequiredFieldValidator9&quot; CssClass=&quot;ErrMsg&quot; ForeColor=&quot; &quot;
                     ValidationGroup=&quot;Add&quot; ControlToValidate=&quot;ddlProductCategory&quot; runat=&quot;server&quot; Display=&quot;dynamic&quot;
                     ErrorMessage=&quot;&lt;BR&gt;  Select Product Category&quot; InitialValue=&quot;Select&quot;&gt;&lt;/asp:RequiredFieldValidator&gt;--%&gt;
                 &lt;asp:RequiredFieldValidator ID=&quot;RequiredFieldValidator9&quot; runat=&quot;server&quot; ControlToValidate=&quot;ddlProductCategory&quot;
                     CssClass=&quot;ErrMsg&quot; Display=&quot;dynamic&quot; ErrorMessage=&quot;&amp;lt;BR&amp;gt;  select Category&quot;
                     ForeColor=&quot; &quot; ValidationGroup=&quot;Add&quot;&gt; &lt;/asp:RequiredFieldValidator&gt;
             &lt;/td&gt;
             &lt;td&gt;
                 &lt;asp:Label ID=&quot;lblAsset&quot; runat=&quot;server&quot; Text=&quot;Asset No&quot;&gt;&lt;/asp:Label&gt;
                 &lt;asp:Label ID=&quot;Label45&quot; runat=&quot;server&quot; Text=&quot;*&quot; CssClass=&quot;mandatory&quot; /&gt;
             &lt;/td&gt;
             &lt;td&gt;
                 &lt;asp:TextBox ID=&quot;txtGlobalAsset&quot; runat=&quot;server&quot; Width=&quot;206px&quot; Text=&quot;&quot;&gt;&lt;/asp:TextBox&gt;
                 &lt;asp:RequiredFieldValidator ID=&quot;rfvGlobalAsset&quot; runat=&quot;server&quot; ControlToValidate=&quot;txtGlobalAsset&quot;
                     CssClass=&quot;ErrMsg&quot; Display=&quot;dynamic&quot; ErrorMessage=&quot;&amp;lt;BR&amp;gt;  Enter Asset No&quot;
                     ForeColor=&quot; &quot; ValidationGroup=&quot;Add&quot;&gt; &lt;/asp:RequiredFieldValidator&gt;
             &lt;/td&gt;
         &lt;/tr&gt;
         &lt;tr&gt;
             &lt;td&gt;
                 &lt;asp:Label ID=&quot;lblProd&quot; runat=&quot;server&quot; Text=&quot;Product Name&quot;&gt;&lt;/asp:Label&gt;
                 &lt;asp:Label ID=&quot;Label15&quot; runat=&quot;server&quot; Text=&quot;*&quot; CssClass=&quot;mandatory&quot; /&gt;
             &lt;/td&gt;
             &lt;td colspan=&quot;3&quot;&gt;
                 &lt;asp:DropDownList ID=&quot;ddlProduct&quot; runat=&quot;server&quot; AutoPostBack=&quot;True&quot; OnSelectedIndexChanged=&quot;ddlProduct_SelectedIndexChanged&quot;
                     Width=&quot;610&quot; OnDataBound=&quot;ddlProduct_DataBound&quot;&gt;
                 &lt;/asp:DropDownList&gt;
                 &lt;%--&lt;asp:RequiredFieldValidator ID=&quot;RequiredFieldValidator10&quot; CssClass=&quot;ErrMsg&quot; ForeColor=&quot; &quot;
                     ValidationGroup=&quot;Add&quot; ControlToValidate=&quot;ddlProduct&quot; runat=&quot;server&quot; Display=&quot;dynamic&quot;
                     ErrorMessage=&quot;&lt;BR&gt;  Select Product Name&quot; InitialValue=&quot;Select&quot;&gt;&lt;/asp:RequiredFieldValidator&gt;--%&gt;
                 &lt;asp:RequiredFieldValidator ID=&quot;RequiredFieldValidator5&quot; runat=&quot;server&quot; ControlToValidate=&quot;ddlProduct&quot;
                     CssClass=&quot;ErrMsg&quot; Display=&quot;dynamic&quot; ErrorMessage=&quot;&amp;lt;BR&amp;gt;  select Product Name&quot;
                     ForeColor=&quot; &quot; ValidationGroup=&quot;Add&quot;&gt; &lt;/asp:RequiredFieldValidator&gt;
             &lt;/td&gt;
         &lt;/tr&gt;
         &lt;tr&gt;
             &lt;td nowrap&gt;
                 &lt;asp:Label ID=&quot;Price&quot; runat=&quot;server&quot; Text=&quot;Product Price &quot;&gt;&lt;/asp:Label&gt;&lt;asp:Label
                     ID=&quot;Label36&quot; runat=&quot;server&quot; Text=&quot;(INR)&quot; Font-Bold=&quot;True&quot;&gt;&lt;/asp:Label&gt;
             &lt;/td&gt;
             &lt;td&gt;
                 &lt;asp:Label ID=&quot;lblGPrice&quot; runat=&quot;server&quot; Visible=&quot;true&quot; Text=&quot;Price&quot;&gt;&lt;/asp:Label&gt;
                 &lt;asp:Label ID=&quot;lblfee_type&quot; runat=&quot;server&quot; Visible=&quot;false&quot; Text=&quot;fee_type&quot;&gt;&lt;/asp:Label&gt;
             &lt;/td&gt;
             &lt;td&gt;
                 &lt;asp:Label ID=&quot;Quantity&quot; runat=&quot;server&quot; Text=&quot;Quantity&quot;&gt;&lt;/asp:Label&gt;
                 &lt;asp:Label ID=&quot;Label40&quot; runat=&quot;server&quot; Text=&quot;*&quot; CssClass=&quot;mandatory&quot; /&gt;
             &lt;/td&gt;
             &lt;td&gt;
                 &lt;asp:TextBox CssClass=&quot;textInput&quot; ID=&quot;txtGQuantity&quot; runat=&quot;server&quot; Width=&quot;40&quot; onpaste=&quot;return false&quot;
                     onkeypress=&quot;return onlyNumbers()&quot;&gt;&lt;/asp:TextBox&gt;
                 &lt;asp:RequiredFieldValidator ID=&quot;RequiredFieldValidator12&quot; runat=&quot;server&quot; ControlToValidate=&quot;txtGQuantity&quot;
                     CssClass=&quot;ErrMsg&quot; Display=&quot;dynamic&quot; ErrorMessage=&quot;&amp;lt;BR&amp;gt;  Enter Quantity&quot;
                     ForeColor=&quot; &quot; ValidationGroup=&quot;Add&quot;&gt; &lt;/asp:RequiredFieldValidator&gt;
                 &lt;%--&lt;asp:RangeValidator ID=&quot;RangeValidator1&quot;
                     ControlToValidate=&quot;txtGQuantity&quot;
                     MinimumValue=&quot;1&quot;
                     MaximumValue=&quot;99&quot;
                     Type=&quot;Integer&quot;
                     EnableClientScript=&quot;true&quot;
                     Text=&quot;The qualtity must be greater than &#39;0&#39;&quot;
                     runat=&quot;server&quot; /&gt;--%&gt;
                 &lt;asp:RangeValidator ID=&quot;RegularExpressionValidator1&quot; runat=&quot;server&quot; ControlToValidate=&quot;txtGQuantity&quot;
                     ErrorMessage=&quot;Range should be [1-100]&quot; ValidationGroup=&quot;Add&quot; CssClass=&quot;ErrMsg&quot;
                     Type=&quot;Integer&quot; MaximumValue=&quot;100&quot; MinimumValue=&quot;1&quot;&gt;&lt;/asp:RangeValidator&gt;
             &lt;/td&gt;
         &lt;/tr&gt;
         &lt;tr&gt;
             &lt;td colspan=&quot;4&quot;&gt;
                 &lt;asp:Label ID=&quot;lblQuantityError&quot; runat=&quot;server&quot; ForeColor=&quot;#3399FF&quot; Visible=&quot;false&quot;
                     Text=&quot;&quot;&gt;&lt;/asp:Label&gt;
             &lt;/td&gt;
         &lt;/tr&gt;
         &lt;tr&gt;
             &lt;td colspan=&quot;3&quot;&gt;
                 &lt;asp:Label ID=&quot;lblTotal&quot; runat=&quot;server&quot; Visible=&quot;false&quot; Text=&quot;Total&quot;&gt;&lt;/asp:Label&gt;
                 &lt;asp:Label ID=&quot;lblErrorMessage&quot; runat=&quot;server&quot; Visible=&quot;false&quot; Text=&quot;Error Message&quot;&gt;&lt;/asp:Label&gt;
                 &lt;asp:Label ID=&quot;lblFillTemplate&quot; runat=&quot;server&quot; Visible=&quot;false&quot; Text=&quot;Error Message&quot;
                     ForeColor=&quot;#0066FF&quot;&gt;&lt;/asp:Label&gt;
             &lt;/td&gt;
             &lt;td&gt;
                 &lt;asp:Button ID=&quot;btnADD&quot; Width=&quot;45&quot; runat=&quot;server&quot; Text=&quot;ADD&quot; class=&quot;button&quot; OnClick=&quot;btnADD_Click&quot;
                     ValidationGroup=&quot;Add&quot; /&gt;
             &lt;/td&gt;
         &lt;/tr&gt;
     &lt;/asp:PlaceHolder&gt;</pre>
Posted
Comments
VishwaKL 6-Dec-12 22:27pm    
Use this<asp:PostBackTrigger ControlID="ddlLicenseType" EventName="SelectedIndexChanged" /> insted Of asp:AsyncPostBackTrigger

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900