Set the DropDownList AutoPostBack property for some items
-
How can i set the AutoPostBack property for some items in the dropdownlist ? Example: When i select some items in the dropdownlist, i want the page to postback, while other items should not.
set the AutoPostBack property to FALSE for the dropdownlist (ddl). Create a javascript fucntion e.g.
function ddlOnchange(selectedValue) { if(selectedValue == 'yourrequired value') document.formname.submit(); else return false; }
and add onchange attribute to the ddl in code behind file e.g.ddl.Attributes.Add("onchange", "javascript:ddlOnchange(this.value);");
-----
-
How can i set the AutoPostBack property for some items in the dropdownlist ? Example: When i select some items in the dropdownlist, i want the page to postback, while other items should not.
i dont think you can achieve this with ASP.NET becasue postback is a property of Control not the items associated with that control. for this you have do some extra work to make a custom drop down but still not sure its possible or not.
Usman Munier Xavor Corporation Pakistan