Tell me please, why this sample code doesn’t work on ASP.NET MVC?
Thank you
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
That code does not work, because asp.net mvc does not have knowledge of controls, used in asp.net webforms (ListControl is one of those controls). WebForms controls rely on ViewState and javascripts generated by webforms framework. Asp.net mvc has no concept of viewstate, neither does it generate any default javascript for page.
If you want to trigger action from client side in asp.net mvc, you could write pure html and javascript(using jquery for simplicity).
In controller
And in view
This should alert ‘id is 1’ and ‘id is 2’ accordingly.