我想将两个值从控制器动作传递到asp.net MVC 3 Razor视图.我在行动方法中这样做:
var model = new { reportid = rid, refno = refernumber};
return View(model );
Run Code Online (Sandbox Code Playgroud)
但当我尝试在这样的视图中访问它:
@Model.reportid
Run Code Online (Sandbox Code Playgroud)
我知道,对象不包含属性reportid
如何在不使用viewbag的情况下传递多个值?
我有一个局部视图,我想使用jquery在主视图中呈现它.
以下是我编写jQuery的方法:
$(document).ready(function() {
$("#dvGames").load("/LiveGame/Partial3");
});
Run Code Online (Sandbox Code Playgroud)
控制器方法如下所示:
public ActionResult Partial3(DateTime gameDate)
{
return View("Partial3");
}
Run Code Online (Sandbox Code Playgroud)
我没有看到任何东西.我试过了
<% Html.RenderPartial("Partial3"); %>
Run Code Online (Sandbox Code Playgroud)
它工作但我想在局部视图中过滤数据,所以我使用jquery加载方法.
我已经在我的模型中将一个字段声明为可以为空的日期时间
public DateTime? CallNextDate {get;set;}
Run Code Online (Sandbox Code Playgroud)
在我的aspx代码后面我正在使用这样的linq:
q = q.AsQueryable()
.Where(c => c.CallNextDate.Date < DateTime.Now.Date )
.ToList();
Run Code Online (Sandbox Code Playgroud)
但 c.CallNextDate.Date不可用.请建议如何解决它
有什么区别Html.Partial和Html.action使用在asp.net MVC3的局部视图的背景?
我有这样的linq查询:
var accounts =
from account in context.Accounts
from guranteer in account.Gurantors
where guranteer.GuarantorRegistryId == guranteerRegistryId
select new AccountsReport
{
recordIndex = ?
CreditRegistryId = account.CreditRegistryId,
AccountNumber = account.AccountNo,
}
Run Code Online (Sandbox Code Playgroud)
我想使用LINQ返回的集合中的当前行号的值填充recordIndex.我怎样才能获得行号?
我在我的页面中使用JQuery UI手风琴.我在页面加载时遵循以下Javascript代码:
$(function() {
$("#accordion").accordion({
active: false,
autoHeight: false,
navigation: true,
collapsible: true
});
});
Run Code Online (Sandbox Code Playgroud)
当页面加载时,所有选项卡都会打开几秒钟然后崩溃.可能是它的负载效应.如何在页面加载时折叠Jquery UI折叠.请建议
我正在开发Asp.Net MVC 3应用程序.我已经为网站创建了管理区域,并[Authorized]在登录后将属性应用于actionmethods.当我尝试直接访问这些URL而无需像admin/home或admin/productlist那样登录时,我被重定向到/ Home/Login并出现身份验证错误.我想重定向到管理员/登录.
请建议.谢谢
我想将我的ASP.NET MVC控制器操作命名为123games但由于数字而不允许我.
我需要使用ActionNameAttribute吗?
我在我的asp.net页面中使用bootstrap模式,如下所示:
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
aria-hidden="true">
<asp:UpdatePanel ID="ModalUpdatePanel" runat="server" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnRegister" EventName="Click" />
</Triggers>
<ContentTemplate>
<p>
textboxes here
<div class="popup-footer-wrapper">
<div class="popup-footer-left">
<%-- <input type="submit" class="login-button" name="login-button" value="Sign Up">--%>
<asp:Button ID="btnRegister" runat="server" CssClass="login-button" OnClick="btnRegister_Click"
UseSubmitBehavior="false" Text="<%$ Resources: HRGELoggedOutMaster, Signup %>" />
</div>
</div>
</p>
</ContentTemplate>
</asp:UpdatePanel>
</div>
Run Code Online (Sandbox Code Playgroud)
我在里面看到了
protected void btnRegister_Click(object sender, EventArgs e)
Run Code Online (Sandbox Code Playgroud)
所有texbox都显示空值.文本框中的任何用户类型.请建议如何解决它.可能是因为UseSubmitBehavior ="false"但是如果我不使用它,那么控制不会转到onclick事件.
我asp.net在visual studio 2010终极版中创建了一个项目.
我看不到标准,数据等工具箱标签,我只能看到Telerik和HTML控件.
我试图重置工具箱,试图删除C:\Users\mypcuser\AppData\Local\Microsoft\VisualStudio\10.0\*.tbd.
我也试过,devenv /ResetSkipPkgs但没有任何对我有用.
请建议解决方案谢谢!
asp.net-mvc ×5
asp.net ×2
jquery ×2
linq ×2
.net ×1
c# ×1
javascript ×1
jquery-ui ×1
partial ×1
toolbox ×1