如何从c#asp.net中的控制器将文本返回到.cshtml中的范围
我只是有一个问题,我不知道这是否可能。我一直在四处寻找,什么也没找到。我很好奇在我的登录控制器中是否有这样的信息。如果其中一个If语句失败,是否有任何方法可以在登录视图上向span返回一些文本 假设在登录控制器的登录方法中失败:如何从c#asp.net中的控制器将文本返回到.cshtml中的范围,c#,html,asp.net,asp.net-mvc,razor,C#,Html,Asp.net,Asp.net Mvc,Razor,我只是有一个问题,我不知道这是否可能。我一直在四处寻找,什么也没找到。我很好奇在我的登录控制器中是否有这样的信息。如果其中一个If语句失败,是否有任何方法可以在登录视图上向span返回一些文本 假设在登录控制器的登录方法中失败: if (BadCredentials(checkLogin) == null) { return RedirectToAction("Login", "Login"); } 是否有任何方法可以将其设置为将文本返回到此范围而不是重
if (BadCredentials(checkLogin) == null)
{
return RedirectToAction("Login", "Login");
}
是否有任何方法可以将其设置为将文本返回到此范围而不是重定向
<span class="help-block"></span>
您可以在中设置值,并在视图中使用该值
内部控制器
鉴于
@ViewBag.YourValue
您可以在中设置值,并在视图中使用该值
内部控制器
鉴于
@ViewBag.YourValue
您可以在中设置值,并在视图中使用该值
内部控制器
鉴于
@ViewBag.YourValue
您可以在中设置值,并在视图中使用该值
内部控制器
鉴于
@ViewBag.YourValue
在控制器中:
if (BadCredentials(checkLogin) == null)
{
ViewBag.SpanText = "This is span text";
}
你的看法:
<span class="help-block">@ViewBag.SpanText</span>
@ViewBag.SpanText
在控制器中:
if (BadCredentials(checkLogin) == null)
{
ViewBag.SpanText = "This is span text";
}
你的看法:
<span class="help-block">@ViewBag.SpanText</span>
@ViewBag.SpanText
在控制器中:
if (BadCredentials(checkLogin) == null)
{
ViewBag.SpanText = "This is span text";
}
你的看法:
<span class="help-block">@ViewBag.SpanText</span>
@ViewBag.SpanText
在控制器中:
if (BadCredentials(checkLogin) == null)
{
ViewBag.SpanText = "This is span text";
}
你的看法:
<span class="help-block">@ViewBag.SpanText</span>
@ViewBag.SpanText
您可以使用Viewbag属性显示控制器中的数据,以便在.cshtml中查看
在控制器中:
ViewBag.Name=“您的文本”
在.cshtml中:
@ViewBag.Name您可以使用ViewBag属性显示控制器中的数据,以便在.cshtml中查看 在控制器中: ViewBag.Name=“您的文本” 在.cshtml中:
@ViewBag.Name您可以使用ViewBag属性显示控制器中的数据,以便在.cshtml中查看 在控制器中: ViewBag.Name=“您的文本” 在.cshtml中:
@ViewBag.Name您可以使用ViewBag属性显示控制器中的数据,以便在.cshtml中查看 在控制器中: ViewBag.Name=“您的文本” 在.cshtml中: @控制器上的ViewBag.Name
@{
var ImageFile = System.Web.HttpContext.Current.Server.MapPath("~/Document/Picture/" + @Request.Cookies["sTimeStamp"].Value + ".jpg");
var PanFile = System.Web.HttpContext.Current.Server.MapPath("~/Document/PAN/" + @Request.Cookies["sTimeStamp"].Value + ".jpg");
var AdhaarFile = System.Web.HttpContext.Current.Server.MapPath("~/Document/Adhaar/" + @Request.Cookies["sTimeStamp"].Value + ".jpg");
}
@if (System.IO.File.Exists(ImageFile) == false || System.IO.File.Exists(PanFile) == false || System.IO.File.Exists(AdhaarFile) == false)
{
ViewBag.KycMessage = "Your KYC has not completed yet. KYC is mandatory to get payment you earned. Following is list of document which is not uploaded.";
}
else
{
ViewBag.KycMessage = "<span style=\"color:green\">KYC Comlete</span>";
}
<span>@ViewBag.KycMessage</span>
@{
var ImageFile=System.Web.HttpContext.Current.Server.MapPath(“~/Document/Picture/”++@Request.Cookies[“sTimeStamp”].Value+.jpg”);
var PanFile=System.Web.HttpContext.Current.Server.MapPath(“~/Document/PAN/”++@Request.Cookies[“sTimeStamp”].Value+.jpg”);
var AdhaarFile=System.Web.HttpContext.Current.Server.MapPath(“~/Document/Adhaar/”++@Request.Cookies[“sTimeStamp”].Value+.jpg”);
}
@if(System.IO.File.Exists(ImageFile)==false | | | System.IO.File.Exists(PanFile)==false | | | System.IO.File.Exists(AdhaarFile)==false)
{
ViewBag.KycMessage=“您的KYC尚未完成。必须使用KYC才能获得您赢得的付款。以下是未上载的文档列表。”;
}
其他的
{
ViewBag.KycMessage=“KYC Comlete”;
}
@ViewBag.KycMessage
在您的控制器上
@{
var ImageFile = System.Web.HttpContext.Current.Server.MapPath("~/Document/Picture/" + @Request.Cookies["sTimeStamp"].Value + ".jpg");
var PanFile = System.Web.HttpContext.Current.Server.MapPath("~/Document/PAN/" + @Request.Cookies["sTimeStamp"].Value + ".jpg");
var AdhaarFile = System.Web.HttpContext.Current.Server.MapPath("~/Document/Adhaar/" + @Request.Cookies["sTimeStamp"].Value + ".jpg");
}
@if (System.IO.File.Exists(ImageFile) == false || System.IO.File.Exists(PanFile) == false || System.IO.File.Exists(AdhaarFile) == false)
{
ViewBag.KycMessage = "Your KYC has not completed yet. KYC is mandatory to get payment you earned. Following is list of document which is not uploaded.";
}
else
{
ViewBag.KycMessage = "<span style=\"color:green\">KYC Comlete</span>";
}
<span>@ViewBag.KycMessage</span>
@{
var ImageFile=System.Web.HttpContext.Current.Server.MapPath(“~/Document/Picture/”++@Request.Cookies[“sTimeStamp”].Value+.jpg”);
var PanFile=System.Web.HttpContext.Current.Server.MapPath(“~/Document/PAN/”++@Request.Cookies[“sTimeStamp”].Value+.jpg”);
var AdhaarFile=System.Web.HttpContext.Current.Server.MapPath(“~/Document/Adhaar/”++@Request.Cookies[“sTimeStamp”].Value+.jpg”);
}
@if(System.IO.File.Exists(ImageFile)==false | | | System.IO.File.Exists(PanFile)==false | | | System.IO.File.Exists(AdhaarFile)==false)
{
ViewBag.KycMessage=“您的KYC尚未完成。必须使用KYC才能获得您赢得的付款。以下是未上载的文档列表。”;
}
其他的
{
ViewBag.KycMessage=“KYC Comlete”;
}
@ViewBag.KycMessage
在您的控制器上
@{
var ImageFile = System.Web.HttpContext.Current.Server.MapPath("~/Document/Picture/" + @Request.Cookies["sTimeStamp"].Value + ".jpg");
var PanFile = System.Web.HttpContext.Current.Server.MapPath("~/Document/PAN/" + @Request.Cookies["sTimeStamp"].Value + ".jpg");
var AdhaarFile = System.Web.HttpContext.Current.Server.MapPath("~/Document/Adhaar/" + @Request.Cookies["sTimeStamp"].Value + ".jpg");
}
@if (System.IO.File.Exists(ImageFile) == false || System.IO.File.Exists(PanFile) == false || System.IO.File.Exists(AdhaarFile) == false)
{
ViewBag.KycMessage = "Your KYC has not completed yet. KYC is mandatory to get payment you earned. Following is list of document which is not uploaded.";
}
else
{
ViewBag.KycMessage = "<span style=\"color:green\">KYC Comlete</span>";
}
<span>@ViewBag.KycMessage</span>
@{
var ImageFile=System.Web.HttpContext.Current.Server.MapPath(“~/Document/Picture/”++@Request.Cookies[“sTimeStamp”].Value+.jpg”);
var PanFile=System.Web.HttpContext.Current.Server.MapPath(“~/Document/PAN/”++@Request.Cookies[“sTimeStamp”].Value+.jpg”);
var AdhaarFile=System.Web.HttpContext.Current.Server.MapPath(“~/Document/Adhaar/”++@Request.Cookies[“sTimeStamp”].Value+.jpg”);
}
@if(System.IO.File.Exists(ImageFile)==false | | | System.IO.File.Exists(PanFile)==false | | | System.IO.File.Exists(AdhaarFile)==false)
{
ViewBag.KycMessage=“您的KYC尚未完成。必须使用KYC才能获得您赢得的付款。以下是未上载的文档列表。”;
}
其他的
{
ViewBag.KycMessage=“KYC Comlete”;
}
@ViewBag.KycMessage
在您的控制器上
@{
var ImageFile = System.Web.HttpContext.Current.Server.MapPath("~/Document/Picture/" + @Request.Cookies["sTimeStamp"].Value + ".jpg");
var PanFile = System.Web.HttpContext.Current.Server.MapPath("~/Document/PAN/" + @Request.Cookies["sTimeStamp"].Value + ".jpg");
var AdhaarFile = System.Web.HttpContext.Current.Server.MapPath("~/Document/Adhaar/" + @Request.Cookies["sTimeStamp"].Value + ".jpg");
}
@if (System.IO.File.Exists(ImageFile) == false || System.IO.File.Exists(PanFile) == false || System.IO.File.Exists(AdhaarFile) == false)
{
ViewBag.KycMessage = "Your KYC has not completed yet. KYC is mandatory to get payment you earned. Following is list of document which is not uploaded.";
}
else
{
ViewBag.KycMessage = "<span style=\"color:green\">KYC Comlete</span>";
}
<span>@ViewBag.KycMessage</span>
@{
var ImageFile=System.Web.HttpContext.Current.Server.MapPath(“~/Document/Picture/”++@Request.Cookies[“sTimeStamp”].Value+.jpg”);
var PanFile=System.Web.HttpContext.Current.Server.MapPath(“~/Document/PAN/”++@Request.Cookies[“sTimeStamp”].Value+.jpg”);
var AdhaarFile=System.Web.HttpContext.Current.Server.MapPath(“~/Document/Adhaar/”++@Request.Cookies[“sTimeStamp”].Value+.jpg”);
}
@if(System.IO.File.Exists(ImageFile)==false | | | System.IO.File.Exists(PanFile)==false | | | System.IO.File.Exists(AdhaarFile)==false)
{
ViewBag.KycMessage=“您的KYC尚未完成。必须使用KYC才能获得您赢得的付款。以下是未上载的文档列表。”;
}
其他的
{
ViewBag.KycMessage=“KYC Comlete”;
}
@ViewBag.KycMessage
你们俩都很棒!谢谢你们的回答。你们都很棒!谢谢你们的回答。你们都很棒!谢谢你们的回答。你们都很棒!谢谢你的回答。