0

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 1

0

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.

Sign up to request clarification or add additional context in comments.

1 Comment

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...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.