我如何在Mvc Razor视图中使用特定的Url.Action [英] How I Go To The Specific Url.Action In Mvc Razor View
本文介绍了我如何在Mvc Razor视图中使用特定的Url.Action的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
先生,
我有drobdownlist有两个文本,即Load File&发送邮件,我想当我选择适当的单词时,通过GO按钮进入他们的视图,我是怎么做的。
我在这里下面的代码不起作用。
这是我的JS代码。
< head >
< script type = text / javascript >
$(#go)。click(function(){
var tz = $(#Selector)。val();
var loader =Email Loader;
var Sender =发送电子邮件;
if(tz == loader){
document.location ='/ Admin / Marketing / Load_File';
}
else if(tz == Sender)
{
document.location ='/ Admin / Marketing / Send_Mail';
}
});
< / script >
< / head >
这是我的Drobdownlist&按钮代码。
< 选择 class = form-control input-sm id = 选择器 >
< 选项 值 = 1 > ; 电子邮件加载程序< / option > ;
< 选项 value = 2 > 发送电子邮件< / option >
< span class =code-keyword>< / select >
< / div >
< div class = row < span class =code-keyword>>
< 按钮 class = btn red style = float:left; margin-top:10px; margin-left:32px; id = go > 转到< ; / button > < / div >
请帮助
问候,
Tahir
解决方案
(#go ).click(function(){
var tz =
(#Selector)。val();
var loader = Email Loader;
var Sender =发送电子邮件;
if(tz == loader){
document.location ='/ Admin / Marketing / Load_File';
}
else if(tz == Sender)
{
document.location ='/ Admin / Market ING / Send_Mail';
}
});
< / script >
< / head >
这是我的Drobdownlist&按钮代码。
< 选择 class = form-control input-sm id = 选择器 >
< 选项 值 = 1 > ; 电子邮件加载程序< / option > ;
<选项 value = 2 > 发送电子邮件< / option >
< span class =code-keyword>< / select >
< / div >
< div class = row < span class =code-keyword>>
< 按钮 class = btn red style = float:left; margin-top:10px; margin-left:32px; id = go > 转到< ; / button > < / div >
请帮助
问候,
Tahir
你的代码的问题是val返回选项的value属性,而不是其文本。
var tz =
Hi sir,
I have the drobdownlist which have two texts i.e Load File & Send Mail, I want when i select the appropriate word its go to their view through GO button, how i do this.
I am here the below code which not work.
This is my JS code.
<head>
<script type="text/javascript">
$("#go").click(function () {
var tz = $("#Selector").val();
var loader = "Email Loader";
var Sender = "Send email";
if (tz == loader) {
document.location = '/Admin/Marketing/Load_File';
}
else if (tz == Sender)
{
document.location = '/Admin/Marketing/Send_Mail';
}
});
</script>
</head>
This is my Drobdownlist & button code.
<select class="form-control input-sm" id="Selector">
<option value="1">Email Loader</option>
<option value="2">Send email</option>
</select>
</div>
<div class="row">
<button class="btn red"style=" float: left; margin-top: 10px; margin-left: 32px;" id="go">Go</button> </div>
Please help
Regards,
Tahir
解决方案
("#go").click(function () { var tz =
("#Selector").val(); var loader = "Email Loader"; var Sender = "Send email"; if (tz == loader) { document.location = '/Admin/Marketing/Load_File'; } else if (tz == Sender) { document.location = '/Admin/Marketing/Send_Mail'; } }); </script> </head>
This is my Drobdownlist & button code.
<select class="form-control input-sm" id="Selector"> <option value="1">Email Loader</option> <option value="2">Send email</option> </select> </div> <div class="row"> <button class="btn red"style=" float: left; margin-top: 10px; margin-left: 32px;" id="go">Go</button> </div>
Please help
Regards,
Tahir
The problem with your code is that val returns the value attribute of the option, not its text.
var tz =
这篇关于我如何在Mvc Razor视图中使用特定的Url.Action的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文