I have created a gridview with dropdownlist in asp.net(c#).i want to validate dropdownlist using jvascript.if i dont select anything from dropdownlist that time script shud display a message.i don know how to get the name or id of that dropdownlist
1 Answer
You can inject some C# within the Javascript section, like:
var mylist = document.getElementById('<%= MyDropDownList.ClientID %>');
Be careful, though.
If you get excited and start changing values in the dropdown list on the Javascript side, you will get a security exception when you try to submit the form; I forgot what it was called.
1 Comment
roopesh
it is not working..coz m using dropdownlist inside of gridview...and while clicking on submit button it shud iterate through all the rows in gridview...