我有一个MVC Kendo Grid如下.它可以正常使用默认分页.
现在,我想做自定义分页.在控制器操作中,我们需要知道当前页面索引.它还应该设置网格的"总"计数.[即使数据库中有100条记录,实际数据源一次也只有2条记录.因此,网格必须使用"total"属性知道数据库中的记录总数.
查询一次只能返回数据库中的2条记录.
我们如何使用Kendo Grid的MVC包装器来执行此自定义服务器分页?
@using (Html.BeginForm())
{
@(Html.Kendo().Grid<KendoUIMvcSample.Models.Sample>()
.Name("ssgrid222")
.Columns(columns => {
columns.Bound(p => p.SampleDescription).Filterable(false).Width(100);
columns.Bound(p => p.SampleCode).Filterable(false).Width(100);
columns.Bound(p => p.SampleItems).Filterable(false).Width(100);
})
.AutoBind(false)
.Pageable()
.Sortable()
.Scrollable()
.Filterable()
.HtmlAttributes(new { style = "height:430px;" })
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(2)
.Read(read => read.Action("Orders_Read", "Sample")
)
)
)
}
Run Code Online (Sandbox Code Playgroud)
调节器
public ActionResult Orders_Read([DataSourceRequest]DataSourceRequest request)
{
int currentPageNumber = request.Page;
return Json(GetOrders().ToDataSourceResult(request));
}
Run Code Online (Sandbox Code Playgroud) asp.net-mvc asp.net-mvc-4 kendo-ui kendo-grid kendo-asp.net-mvc
我提到在jQuery中创建一个div元素并使用javascript 创建一个div元素.但是,当我动态添加按钮元素时,单击不起作用.我们需要做些什么改变才能使按钮点击工作?
注意:由于绑定到嵌套在Dom中的多个视图模型中提到的kendo控制要求,我们无法将该函数移动到document.ready之外
更新的参考文献
码
<head>
<title>Test</title>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://cdn.kendostatic.com/2013.2.716/js/kendo.all.min.js"></script>
<script type="text/javascript">
//lijo
$(document).ready(function ()
{
$(".statiscDIV").append('<div>FIRST</div>');
$(".statiscDIV").append('<div>hello <button class="MakeHoldDetailLinkButton" onclick = "showMakeAndHold();">View</button> </div>');
//lijo
function showMakeAndHold()
{
alert("HIIIIIII");
}
});
</script>
</head>
<body>
<div class="statiscDIV">
A
</div>
</body>
Run Code Online (Sandbox Code Playgroud) 我有以下使用引导程序的html。它在大多数情况下都有效-但是没有显示关闭按钮来显示警报。我在这里缺少什么代码?请注意,我是Bootstrap的新手-因此,它可能很简单。
小提琴:http : //jsfiddle.net/LijoCheeran/vxbt960c/
码
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap 101 Template</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
</head>
<body>
<h1>Hello, world!</h1>
<div class="alert alert-success">
<strong>Success!</strong> Bootstrap applied to alert.
</div>
<div style = "padding: 10px 10px 10px;">
<form class = "bs-example bs-example-form" role = "form">
<div class = "input-group">
<span class = "input-group-addon">$</span>
<input type = "text" class = "form-control" placeholder = "Amount">
<span class = "input-group-addon">.00</span> …Run Code Online (Sandbox Code Playgroud) 我有一个API调用,如下所示:
JsonValue result = api.GET("/chart/" + problemList.PatientMRN.ToString() + "/problems", problemInfo);
string resultString = result.ToString();
Run Code Online (Sandbox Code Playgroud)
注意:我指的是System.Json.JsonValue
替代方法(使用JavaScriptSerializer)
Rootobject_Labresult objGResponse = new JavaScriptSerializer().Deserialize<Rootobject_Labresult>(resultString);
Run Code Online (Sandbox Code Playgroud)
从Json中的字符串,我创建了相应的类(使用Visual Studio编辑菜单中的Paste Special).
public class Rootobject_Labresult
{
public Labresult[] labresults { get; set; }
public int totalcount { get; set; }
}
public class Labresult
{
public string createddate { get; set; }
public DateTime createddatetime { get; set; }
public string departmentid { get; set; }
public string description { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
但是当我创建一个数组时,我得到了以下错误.
Labresult[] labresults = …Run Code Online (Sandbox Code Playgroud) 我们想在 SQL Server 中存储会话。我们有 sessionState 模式=“SQLServer”。我得到了一个示例连接字符串,如下所示。在这里它同时具有 stateConnectionString 和 sqlConnectionString。
问题:为什么当 mode="SQLServer" 时我们需要 stateConnectionString?
<sessionState mode="SQLServer"
cookieless="false" timeout="20"
stateConnectionString="tcpip=XXX.XX.XXX.XXX:42424"
sqlConnectionString="data source=XXX-FFFF-sql2k8,2025;
Initial Catalog=AspState_XX_3_0;user id=XXX;password=XXX"
allowCustomSqlDatabase="true"
sqlCommandTimeout="1200"/>
Run Code Online (Sandbox Code Playgroud)
注 1:SQLServer 模式将会话状态存储在 SQL Server 数据库中。使用此模式可确保在 Web 应用程序重新启动时保留会话状态,并使会话状态可供 Web 场中的多个 Web 服务器使用。要使用 SQLServer 模式,必须首先确保 SQL Server 上安装了 ASP.NET 会话状态数据库。您可以使用 Aspnet_regsql.exe 工具安装 ASP.NET 会话状态数据库
注 2:StateServer 模式将会话状态存储在称为 ASP.NET 状态服务的进程中,该进程独立于 ASP.NET 辅助进程或 IIS 应用程序池。要使用 StateServer 模式,必须首先确保 ASP.NET 状态服务正在用于会话存储的服务器上运行。要在 Web 场中使用 StateServer 模式,您必须在 Web 配置的 machineKey 元素中为属于 Web 场的所有应用程序指定相同的加密密钥。
我们的网站使用"NT Authority\Network Service".
Response.Write(WindowsIdentity.GetCurrent().Name);
Run Code Online (Sandbox Code Playgroud)
该网站使用IIS 7.5中托管的WCF服务.当我们浏览服务时,我们收到以下错误 - " HTTP错误401.3 - 未经授权.由于Web服务器上此资源的访问控制列表(ACL)配置或加密设置,您无权查看此目录或页面."
注意:我们已经 在文件夹上授予了对IIS_IUSRS和IUSR的读取权限.
任何想法,我们如何解决这个错误?
该服务的应用程序池具有以下详细信息
.NET Framework版本:.NET Framework v4.0.30319
管理管道模式:经典
服务的应用程序具有以下配置
• 匿名身份验证:已启用
•Windows身份验证:已禁用
•ASP.NET模拟:已禁用
•表单身份验证:已禁用
在回发期间,__EVENTTARGET表单变量保存name of the control发回回的内容.如果控件支持多个服务器端事件,ASP.NET如何知道为该控件触发哪个事件?
我有以下HTML表格.我需要为每列提供背景颜色(第一列=红色,第二列=黄色,第三列=蓝色).我怎么能用CSS做到这一点?
注意:这需要在IE6以后工作.
http://jsfiddle.net/Lijo/kw4yU/
<table id = "myTable">
<thead>
<tr>
<th>
Name
</th>
<th>
Address
</th>
<th>
Age
</th>
</tr>
</thead>
<tr>
<td>
Lijo
</td>
<td>
India
</td>
<td>
27
</td>
</tr>
</table>
Run Code Online (Sandbox Code Playgroud)
编辑:
我通过将js代码放在document.ready中来实现它.感谢@Jose Rui Santos http://jsfiddle.net/Lijo/kw4yU/11/
另一个解决方案是http://jsfiddle.net/Lijo/kw4yU/12/
另一种方法:列宽设置 - HTML表
我有一个名为resultGridTable的表.我有一个jQuery函数要在表的每一行上执行.在函数中,"this"表示一行.
对于第四行,我需要提醒第一列值(第四行).我有以下代码; 但它不起作用.我们怎样才能让它发挥作用?
对于第五行,我需要提醒行中的列数.我们怎么做?
在第六行的第二列中,我有两个按钮(输入类型="提交").我需要提醒第二个按钮的文本/值.(第二个按钮有一个名为"secondButton"的类)我们怎么做呢?
以下是代码::
$('#resultGridTable tr').each(function (i)
{
//"this" means row
//Other operations in the row. Common for all rows
if(i==3)
{
//Specific Operation for fourth row
var columnValue = $(this 'td:nth-child(0)').val();
alert(columnValue);
}
});
Run Code Online (Sandbox Code Playgroud)
相关阅读:
我有一个表格,每行都有一个隐藏字段.当单击该行中的按钮时,我需要提醒隐藏字段的值.我有以下jQuery代码.但它不起作用.我们如何让它发挥作用?
代码:http://jsfiddle.net/Lijo/xWanB/
<script>
$(document).ready(function () {
//"Show ID" for Associate Button Click
$('.resultGridTable tr > td > .actionButtonNational').click(function () {
//"this" means show ID button
//Traversing to get the parent row and then the required columns in the row
var associateID = $(this).parents('tr:first > .wrapperDivHidden input[type=hidden]').val();
alert(associateID);
return false;
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
HTML
<td>
XXXXX
<input type="submit" name="ctl00$detailContentPlaceholder$grdSubscribedAssociates$ctl04$btnNational"
value="Show ID" id="detailContentPlaceholder_grdSubscribedAssociates_btnNational_2"
class="actionButtonNational" style="color: White; background-color: #A7A7A6;
font-weight: bold; width: 60px" />
<div id="wrapperDivHidden" class="wrapperDivHidden">
<input type="hidden" name="ctl00$detailContentPlaceholder$grdSubscribedAssociates$ctl04$hdnAssociateID" …Run Code Online (Sandbox Code Playgroud) asp.net ×4
javascript ×4
jquery ×4
.net ×3
c# ×3
css ×3
html ×3
vb.net ×2
asp.net-mvc ×1
iis-7 ×1
json.net ×1
kendo-grid ×1
kendo-ui ×1
webforms ×1