I’m working in a web project and I decide to turn in MVC 4 from ASP.NET.
After many issues which I face it, I’m in a position to handle the events raised from the program.
In my previous environment ASPX.NET I was double clicked on a <asp:Button.../>
control and automatically in the code behind I see the related procedure.
And of course every time I hit the button the program goes to this procedure, and the related event click
.
Now in MVC 4 I following the same process, but when I’m trying to hit the button the program never goes to the procedure.
Another example is, when I have a Label control and I want to make it visible or Hidden then I use the
labelId.style.add(“Visibility”,”Hidden”)
or “Visible”.
And another one is:
ValidationSummary.ValidationGroup
Now in MVC happen the same but before I use the controller.
(The reason to use the controller is that I want to go to the asp:button
on_click procedure since the program refuse to go through the event.)
After the controller process the Label control is evaluated but it is completely empty, and with an empty control we can’t do anything.
The same happen in ValidationSummary
is empty and then it threw an error
What I have done until now
When I use the inheritance web.UI.Page
the program throws me this error:
The view at '~ / Views / Home / Index.aspx' must derive from ViewPage
So I change the inheritance to ViewPage
And I use the following Javescript to call the controller:
<script type="text/javascript">
function logSubmit() {
var url = 'loginSubmit';
$.ajax({
type: 'GET',
url: url,
dataType: 'json',
});
}
</script>
And from controller I use these instructions in the function:
Public Function loginSubmit() As JsonResult
Dim routes As New RouteCollection With {.RouteExistingFiles = True}
Return Json(New With {Key Attributes.logSubmit.LoginButton_Click}, JsonRequestBehavior.AllowGet)
End Function
When that happen not any control works from my page.aspx
Is there someone to assist me on this issue?
from page.aspx and code behind (page.aspx.vb) relations problems
0 komentar:
Posting Komentar