How do I hide a "submit" type button on server side in asp.net mvc2 using c#?
+1
A:
You can use server-side tags in your view. For example:
<% if (Model.ShowSubmitButton) { %>
<input type="submit"/>
<% } %
Adrian Grigore
2010-09-03 14:06:11
@ Sohnee -- can you provide more example please?
hersh
2010-09-03 14:32:40
@ Sohnee: I think the problem is that you are trying to code for ASP.NET MVC as if it was ASP.NET. In ASP.NET you would simply have a server-side event handler that could hide the button for you. ASP.NET MVC, there are no server-side controls. You have to reload the page (or parts of it) and omit the button in the newly loaded page as required. How you do this is entirely up to you and cannot be answered if you don't provide more information in your question. For example, you might reload the page via ajax or with a simple form postback.
Adrian Grigore
2010-09-03 14:44:32
@ Adrian Grigore -- the page reload with a form of post.
hersh
2010-09-03 14:58:39
How you post to the server is just one of the many options you will have to choose. Even if I would provide you with the full source code for a controller and view, I'm sure you'd soon have the next question because it seems you are lacking the basics in understanding ASP.NET MVC. I would recommend having a look at the tutorials at http://www.asp.net/mvc/tutorials . They come with plenty of examples. Then come back to this site when you have some specific questions.
Adrian Grigore
2010-09-03 15:19:52