在使用MVC 4的下一个剃刀页面的方式 [英] In the way for the next razor page using MVC 4
问题描述
当我开始使用MVC4时,我在更改页面(razor页面)的问题上进行了叠加。
在我的`mainPage`中完成工作,现在是时候了到我的`loginPage`。
因为这个原因我在`mainControllwer`中使用这个函数:
While I'm starting using MVC4 I stack in the issue of changing the page (razor page).
In my `mainPage` finshing the job and now is the time to go to my `loginPage`.
For that reason I use this function in my `mainControllwer`:
Public Function FlagBtn_Click(ByVal myFlag As String) As ActionResult
Attributes.envProp._LanguageFlag = myFlag
Return ViewData("")
End Function
在`loginController`中我有这个函数:
And in `loginController` I have this function:
Function Index() As ActionResult
Dim myView As String = "../Views/Login/loginPage.aspx"
Return View(myView)
End Function
在我的`mainLayout`中我有这个`ajax` acript:
And in my `mainLayout` I have this `ajax` acript:
<script type="text/javascript">
function FlagBtnOnClick(flag) {
var flagName = flag;
$.ajax({
type: 'GET',
url: '@Url.Action("FlagBtn_Click")',
dataType: 'json',
data: { myFlag: flagName },
});
LoginPage();
function LoginPage() {
$.ajax({
type: 'POST',
url: 'login'
dataType: 'json',
});
}
</script>
这是因为我想在执行传递属性值后打开我的新页面`loinPage `这是一个`* .aspx`page。
下面(使用debbuger)我看到程序从`viewStart`页面传递到`loginPage`的开头。只有当我使用`.vbhtml`页面时才会这样。
从那里到页面的末尾(页脚)。不在`'.aspx`页面
没有传递来自`html`文件的其余部分。
而不是它返回到`mainLayout`没有任何错误把我扔到`Chrome`调试器上。对于html页面。并且对于'aspx`页面有以下错误
对于`.aspx`我是错误的。
That is because I want, after the execution of passing the property value to open my new page `loinPage` which is an `*.aspx`page.
Following (with the debbuger) I see that the program comes to the start of the `loginPage` passing from `viewStart` page. That is only if I use an `.vbhtml` page.
And from there goes to the end of the page (footer). Not in the `'.aspx` page
Without passing from the rest of the `html` file.
Instead of that it returns to the `mainLayout` without any error threw me on the `Chrome` debugger. For html page. And whith the following error for the `aspx` page
For `.aspx` thew me the error of.
VM27 jquery.min.js:6 XHR finished loading: GET "http://localhost:49254/main/FlagBtn_Click?myFlag=gr".
send @ VM27 jquery.min.js:6
ajax @ VM27 jquery.min.js:6
FlagBtnOnClick @ (index):54
onclick @ (index):109
VM27 jquery.min.js:6
XHR failed loading: POST "http://localhost:49254/login".
来自那里有'mainPage`。
显然我做错了什么......但是什么???
另外我可以说我对两个页面都使用相同的`LayoutPage`。
我尝试了什么:
通过上面的帖子,我提供了迄今为止所做的一切。
And from there to the `mainPage`.
It obvious that I'm doing something wrong... But what???
Additionally I can say that I'm using the same `LayoutPage` for both of the pages.
What I have tried:
With the above post I give everything I have made until now.
推荐答案
.ajax({
type:'GET',
url:'@ Url.Action(FlagBtn_Click)',
dataType:'json',
data:{myFlag:flagName},
});
LoginPage();
函数LoginPage(){
.ajax({ type: 'GET', url: '@Url.Action("FlagBtn_Click")', dataType: 'json', data: { myFlag: flagName }, }); LoginPage(); function LoginPage() {
.ajax({
type:'POST',
url:'login'
dataType:' json',
});
}
< / script>
.ajax({ type: 'POST', url: 'login' dataType: 'json', }); } </script>
这是因为我想在执行传递属性值后打开我的新页面`loinPage `这是一个`* .aspx`page。
下面(使用debbuger)我看到程序从`viewStart`页面传递到`loginPage`的开头。只有当我使用`.vbhtml`页面时才会这样。
从那里到页面的末尾(页脚)。不在`'.aspx`页面
没有传递来自`html`文件的其余部分。
而不是它返回到`mainLayout`没有任何错误把我扔到`Chrome`调试器上。对于html页面。并且对于'aspx`页面有以下错误
对于`.aspx`我是错误的。
That is because I want, after the execution of passing the property value to open my new page `loinPage` which is an `*.aspx`page.
Following (with the debbuger) I see that the program comes to the start of the `loginPage` passing from `viewStart` page. That is only if I use an `.vbhtml` page.
And from there goes to the end of the page (footer). Not in the `'.aspx` page
Without passing from the rest of the `html` file.
Instead of that it returns to the `mainLayout` without any error threw me on the `Chrome` debugger. For html page. And whith the following error for the `aspx` page
For `.aspx` thew me the error of.
VM27 jquery.min.js:6 XHR finished loading: GET "http://localhost:49254/main/FlagBtn_Click?myFlag=gr".
send @ VM27 jquery.min.js:6
ajax @ VM27 jquery.min.js:6
FlagBtnOnClick @ (index):54
onclick @ (index):109
VM27 jquery.min.js:6
XHR failed loading: POST "http://localhost:49254/login".
来自那里有'mainPage`。
显然我做错了什么......但是什么???
另外我可以说我对两个页面都使用相同的`LayoutPage`。
我尝试了什么:
通过上面的帖子,我提供了迄今为止所做的一切。
And from there to the `mainPage`.
It obvious that I'm doing something wrong... But what???
Additionally I can say that I'm using the same `LayoutPage` for both of the pages.
What I have tried:
With the above post I give everything I have made until now.
这篇关于在使用MVC 4的下一个剃刀页面的方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!