如何将readonly属性设置为HTML Textbox助手类.
<%= Html.TextBox("Email", "abc@abc.com", new { @class = "required email" } )%>
Run Code Online (Sandbox Code Playgroud)
感谢您的回复谢谢
我需要将该web.config appSettings部分的值显示在视图中.
我正在使用<%= Html.Label %>填充
在ASP.NET中,我会使用ConfigurationSettings.AppSettings["FileServer"].
我怎么在MVC中这样做?
我的数据来自我的ASP.NET页面上的实体数据模型表.现在,我必须在按钮单击时将此数据导出到Excel中.
如果它正在使用OLEDB,它就像在这里一样直截了当:http://csharp.net-informations.com/excel/csharp-excel-oledb-insert.htm
这是我从查询表中读取数据的函数:
var model = from i in myEntity.Inquiries
where i.User_Id == 5
orderby i.TX_Id descending
select new {
RequestID = i.TX_Id,
CustomerName = i.CustomerMaster.FirstName,
RequestDate = i.RequestDate,
Email = i.CustomerMaster.MS_Id,
DocDescription = i.Document.Description,
ProductName = i.Product.Name
Run Code Online (Sandbox Code Playgroud) 我在ASP.NET MVC View页面上有HTML表.现在我必须将此表导出到Excel.
(1)我使用了部分视图(Inquiries.ascx)来显示数据库中的表数据(使用LINQ to Entity)(2)我也使用了UITableFilter插件来过滤记录(例如:http://gregweber.info/ projects/demo/flavorzoom.html)
(3)在任何时候,我都必须将可见记录过滤到Excel.
感谢您的回复.
谢谢
丽塔
这是我的观点:
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Mvc.Master" Inherits="System.Web.Mvc.ViewPage" %>
<asp:Content ID="Content2" ContentPlaceHolderID="cphHead" runat="server">
<script src="../../Scripts/jquery.tablesorter.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.uitablefilter.js" type="text/javascript"></script>
<script type="text/javascript">
//Load Partial View
$('#MyInquiries').load('/Home/Inquiries');
// To Apply Filter Expression using uiTableFilter plugin
$("#searchName").keyup(function() {
$.uiTableFilter($("#tblRefRequests"), this.value);
$("#tblRefRequests").tablesorter({ widthFixed: true, widgets: ['zebra'] });
});
//Export the HTML table contents to Excel
$('#export').click(function() {
//Code goes here
});
</script>
</asp:Content>
//Main Content
<asp:Content ID="Content1" ContentPlaceHolderID="cphContent" runat="server">
<h2 class="pageName">View …Run Code Online (Sandbox Code Playgroud)