How to: Enable Default Paging in the GridView Web Server Control

https://msdn.microsoft.com/en-us/library/y71xk4a7(v=vs.100).aspx

To enable paging in the Properties window

GridView Class

DataBind

Use the DataBind() method to bind data from a data source to the GridView control. This method resolves all data-binding expressions in the active template of the control.

The DataBind method is called automatically if the DataSourceID property of the GridView control refers to a valid data source control.

Instead of manually calling the DataBind method, you can use model binding with your DataBind control by setting the SelectMethod property to the name of a method that returns data for the GridView. The GridView is then automatically populated with the data that is returned from the select method. Model binding can simplify your code for working with data. For more information, see Model Binding and Web Forms.

DataSource

When you set the DataSource property, the ValidateDataSource method is called.

In addition, if the data-bound control has already been initialized, the OnDataPropertyChanged method is called to set the RequiresDataBinding property to true.

This property cannot be set by themes or style sheet themes. For more information, see ThemeableAttribute and ASP.NET Themes and Skins.

动态添加新的列

private void AddViewColumns()
{ string script = @"$(function ()
{
var selector = '#' + '" + logsGridView.ClientID + @"' + ' :input[type=""image""]';
$(selector).attr('class', 'grid-action view');
}
);
";
ScriptManager.RegisterClientScriptBlock(logsGridView, logsGridView.GetType(), "msBug", script, true);
}

gridview in webform的更多相关文章

  1. webform gridview合并单元格

    gridview合并单元格 由于项目要求,需要合并某些单元格,因此特意封装了如下帮助类: /// <summary> /// 合并单元格 /// </summary> publ ...

  2. .NET各大平台数据列表控件绑定原理及比较(WebForm、Winform、WPF)

    说说WebForm: 数据列表控件: WebForm 下的列表绑定控件基本就是GridView.DataList.Repeater:当然还有其它DropDownList.ListBox等. 它们的共同 ...

  3. webform连接ACCESS数据库

    1.先建立一个名叫mydb.accdb的access数据库 2.他它复制到webform中,放在App_Data文件夹下. 3.在App_Code文件夹下建好封装语句,查询方法,连接语句,其中stud ...

  4. GridView 控件中如何绑定 CheckBoxList

    需求:设计这样一个页面,在页面上可以选择和展示各省份对应的文明城市? 思路:一次性查询出所需的记录(查询数据库的操作不宜写到 C# 代码的循环语句中),并保存到全局变量中,之后根据条件过滤出需要的.可 ...

  5. 20150226--WebForm中GridView

    WebForm中的GridView的用法基本与winForm中的DataGridView一致, 其数据绑定的方法使用LinqDateSource 将GridView拖拽进网页中,出现以下格式: 自动套 ...

  6. GridView+ZedGraph【转】

    edgraph图表控件的强大功能令人出乎意料,与OWC相比我想应该毫不逊色,近来需求要求作出相关数据统计,不想使用BI这类的强大东西,所以搜索到 了免费的开源的Zedgraph控件.使用起来也非常方便 ...

  7. Gridview AutoGenerateColumns属性

    第一篇随笔,以后会陆续的把刚开始工作时的知识点都记录下来,毕竟现在用WebForm的不多了~ AutoGenerateColumns MSDN 说明 : 获取或设置一个值,该值指示是否为数据源中的每个 ...

  8. 关于ASP.NET WebForm与ASP.NET MVC的比较

      WebForm的理解 1. WebForm概念 ASP.NETWebform提供了一个类似于Winform的事件响应GUI模型(event-drivenGUI),隐藏了HTTP.HTML.Java ...

  9. ASP.NET MVC 5 實作 GridView 分頁

    本文用 ASP.NET MVC 5 實作一個 GridView,功能包括: 分頁(paging).關鍵字過濾(filtering).排序(sorting).AJAX 非同步執行,外觀上亦支援 Resp ...

随机推荐

  1. 【转】什么是P问题、NP问题和NPC问题

    原文链接:http://www.matrix67.com/blog/archives/105,感谢Matrix67,看完这篇文章终于把这个几个概念弄明白了!! 这或许是众多OIer最大的误区之一.   ...

  2. DropDownListFor

  3. P1629 邮递员送信(未完成)

    题目描述 有一个邮递员要送东西,邮局在节点1.他总共要送N-1样东西,其目的地分别是2~N.由于这个城市的交通比较繁忙,因此所有的道路都是单行的,共有M条道路,通过每条道路需要一定的时间.这个邮递员每 ...

  4. RecyclerView实现终极画廊效果 中间突出并且压住两侧布局

    先给大家上个gif 要不然下面很枯燥 忘记原来在哪里看到了..... 这个效果我找了NNNNNN长时间,,,我认为凭我现在的能力 写出来需要好久 所以 退而求其次找大神写好的... 你们不要小看了这个 ...

  5. C#中null、""、string.empty区别

    (1)NULLnull 关键字是表示不引用任何对象的空引用的文字值.null 是引用类型变量的默认值.那么也只有引用型的变量可以为NULL,如果int i=null,的话,是不可以的,因为Int是值类 ...

  6. Angular ocLazyLoad 与ui-router的配合使用

    1.resolve state(配置路由时)的resolve参数: resolve:object,将会被注入controller去执行的函数,<string,function>形式. 基于 ...

  7. JdbcTemplate 增删查改

    准备工作:1,拷贝工具类JDBCUtils, 2,导入包commons-logging-1.2-javadoc.jar   spring-beans-5.0.0.RELEASE-javadoc.jar ...

  8. CDR案例:广告条幅banner设计

    本教程练习使用裁剪.位图.变换.阴影.透明度等特殊效果等工具制作广告条幅banner,具体操作如下. 1. 执行“文件”→“新建”命令,打开“创建新文档”对话框,在“宽度”选框右侧选择单位为“像素”, ...

  9. MongoDB 学习笔记(五):固定集合、GridFS文件系统与服务器端脚本

    一.count.distinct与group 1.count函数:查询文档数,如下图: 2.distinct:去重,用法:db.runCommand({distinct:"集合名" ...

  10. NGUI学习随笔

    一.NGUI的直接用法 1.      Attach a Collider:表示为NGUI的某些物体添加碰撞器,如果界面是用NGUI做的,只能这样添加.(注:用Component添加无效). 2.  ...