开发者

Is mvc fully dependent on JavaScript/JQuery?

I have to create a website on MVC 3 but i am restricted not to use JavaScript at all...

All of the stuff i found for MVC is implemented through JQuery. I am in search of the solution that helps me to implement My MVC website without jquery.

I have 3 dependent drpdownlists Country , State and Cit开发者_开发问答y. On Counties List Selection Changed States will be filled with respect to selected country and so on. Although i have done this using Jquery successfully But now i have to d0 this without jquery and the second solution i got is to define an input button to fill child list but of course it is not a good solution too.

Can i define an event in MVC 3 like we do on aspx pages for Dropdown selection change ??

Any help would be highly appreciated...


You would need to have a submit button to push the form to the server to then render the second dd in the cascade. to have more than one submit on a form use the method i blogged about here:

http://blogs.sonatribe.com/wayne/2011/06/15/171/


The "change" event in ASP.NET WebForms DropDownList control uses Javascript to cause a postback to the server when you have AutoPostback set to true. If you can't use Javascript at all, you will have to submit the form through a standard submit button.

Usually the requirement is to make the application work without Javascript, but to use Javascript to provide a richer experience for users with browsers that support it. I think that's more sensible than to not use Javascript at all.


This has nothing to do with MVC or ASP.Net.

If you want your browser to react to input like you describe it, you need JavaScript, independent of the underlaying server side platform.

If your question is: "Can I get the functionality ASP.Net controls provide, like the Postback, without writing JavaScript myself." But you are allowed to use JavaScript, just not write it yourself.

You could probably find some controls for MVC that keep the JavaScript out of sight. But MVC is not the platform for that. It is developed to give the developper close control over the Html (and JavaScript) that is created. So you will probably have to write Javascript yourself anyway.

BTW: You can totally use ASP.Net or Asp.Net MVC without using javascript, and create a functional Website.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜