Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The crux of your question, I believe, is:</p> <p>"when i select any value from drop down i load some data from database that depends on this selected value, i am facing a problem whenever selection changes page will be refreshed."</p> <p>There are many ways to accomplish this, but it might require some restructuring to produce the desired effect. A relatively simple way to do this would be:</p> <p>(1) Reorganize your page as follows:</p> <pre><code>&lt;asp:DropDownList ID="ddList" CssClass="dropdown" Style="width: 200px !important;" runat="server" AutoPostBack="false"&gt; &lt;/asp:DropDownList&gt; &lt;asp:UpdatePanel ID="OuterUpdatePanel" runat="server"&gt; &lt;ContentTemplate&gt; &lt;!-- Content goes here --&gt; &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; </code></pre> <p>(2) Add script as follows:</p> <pre><code>&lt;script type="text/javascript"&gt; function handleDDLChange() { __doPostBack($('div[id$="OuterUpdatePanel"]').attr('id'), 'ddlList_Changed_Or_Anything_Else_You_Might_Want_To_Key_Off_Of'); } $('input[id$="ddlList"]').change( handleDDLChange ); &lt;/script&gt; </code></pre> <p>This is a more "old-school" approach, but it should solve your issue.</p> <p>EDIT: The following illustrates a "non-jQuery" approach, with the above idea a little more fleshed out:</p> <p>ASCX:</p> <pre><code>&lt;asp:ScriptManager runat="server" /&gt; &lt;asp:DropDownList ID="ddlList" runat="server" onchange="handleDDLChange()"&gt; &lt;asp:ListItem Text="text1" /&gt; &lt;asp:ListItem Text="text2" /&gt; &lt;/asp:DropDownList&gt; &lt;script type="text/javascript"&gt; function handleDDLChange() { __doPostBack("&lt;%= ddlList.ClientID %&gt;", "ddlList_Changed_Or_Anything_Else_You_Might_Want_To_Key_Off_Of"); } &lt;/script&gt; &lt;asp:UpdatePanel ID="UpdatePanel1" runat="server"&gt; &lt;ContentTemplate&gt; &lt;asp:Literal ID="litTest" runat="server" /&gt; &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; </code></pre> <p>Code-Behind:</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { litTest.Text = "No postback"; } else if (Request["__EVENTARGUMENT"] == "ddlList_Changed_Or_Anything_Else_You_Might_Want_To_Key_Off_Of") { litTest.Text = string.Format("Dropdown changed: {0}", ddlList.Text); } else { litTest.Text = "Postback for some other reason... :("; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload