how to validate dropdownlist
-
Dear All, i am making web application using asp.net ,C# (Visual studio 2005). i have dropdownlist with first listitem "Select one" and rest of the item comes form database I want to user should not select "Select one " option that is how can i validate dropdowmlist so that user should not select "Select one" Option. please Provide me some idea. Please help thanks
regards imran khan
-
Dear All, i am making web application using asp.net ,C# (Visual studio 2005). i have dropdownlist with first listitem "Select one" and rest of the item comes form database I want to user should not select "Select one " option that is how can i validate dropdowmlist so that user should not select "Select one" Option. please Provide me some idea. Please help thanks
regards imran khan
OK there are many ways to do it most of go with javascript Write javascript code for that Check the dropdownlist selected index should not 0 if it then return false if not then return true very simple :)
Thanks and Regards Sandeep
-
Dear All, i am making web application using asp.net ,C# (Visual studio 2005). i have dropdownlist with first listitem "Select one" and rest of the item comes form database I want to user should not select "Select one " option that is how can i validate dropdowmlist so that user should not select "Select one" Option. please Provide me some idea. Please help thanks
regards imran khan
Hi, Just grab the onchange event of the dropdown in Javascript and validate. See the code below,
function validate() { var e = document.getElementById("myDropDown"); if (e.selectedIndex == 0) // Select One is selected {Alert('some msg'); return false; }
I assume 'Select One' is the first item on the drop down Thanks, MubashirEvery job is a self portrait of the person who did it.
-
Dear All, i am making web application using asp.net ,C# (Visual studio 2005). i have dropdownlist with first listitem "Select one" and rest of the item comes form database I want to user should not select "Select one " option that is how can i validate dropdowmlist so that user should not select "Select one" Option. please Provide me some idea. Please help thanks
regards imran khan