ASP.NET - dropdownlist without postback asp net

Asked By Bhawana on 29-Jun-12 06:42 AM
Lalit M replied to Bhawana on 29-Jun-12 06:46 AM
Using javascript you can do this :  http://www.developerfusion.com/thread/51107/how-to-load-the-dropdownlist-box-without-postback/
Jitendra Faye replied to Bhawana on 29-Jun-12 08:24 AM
Use this code-

.aspx code-

      function show() {
        var drp = document.getElementById('<%=DropDownList3.ClientID%>');
        document.getElementById('<%=Label1.ClientID%>').innerHTML = drp.value;
        alert(drp.value);
        return false;
      }


  <asp:DropDownList ID="DropDownList3" runat="server">
        <asp:ListItem>a</asp:ListItem>
        <asp:ListItem>b</asp:ListItem>
        <asp:ListItem>c</asp:ListItem>
      </asp:DropDownList>
      <asp:Label ID="Label1" runat="server"></asp:Label>

.cs code-

protected void Page_Load(object sender, EventArgs e)
    {
      DropDownList3.Attributes.Add("onchange", "return show();");  
}


Try this and let me know.
RAJASEKHAR RAJENDRAN replied to Bhawana on 29-Jun-12 08:55 AM
Bhavana,

You can achieve this using the Cascading Drop Down Concept i hope. Verify the link below to where you can get the example what can be achieved. http://www.asp.net/ajaxlibrary/AjaxControlToolkitSampleSite/CascadingDropDown/CascadingDropDown.aspx  Thanks & Regards, Rajasekhar.R
Super Man replied to Bhawana on 29-Jun-12 02:22 PM
you can set AutoPostBack property to false.

or you can make use  <Select> <option>...</option> </select > Tags.