分页甚至不显示 [英] Paging not even displaying
本文介绍了分页甚至不显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我正在动态绑定gridview,当我尝试分页时,我什至无法看到页面上的分页.我的编码如下.请
建议我所缺少的内容.我在Page_Init事件中绑定了Gridview.paging根本没有显示GridView.这可能是原因.请建议
Hi All,
I am binding gridview dynamically and when i try for paging I am not able to even see the paging on the page.My coding is as below.Please
suggest what I am misssing.I am binding Gridview in Page_Init event.paging is not showing at all with gridview.what could be the reason.Please suggest
workGrid.RowEditing += new GridViewEditEventHandler(workGrid_RowEditing);
workGrid.RowDeleting += new GridViewDeleteEventHandler(workGrid_RowDeleting);
workGrid.RowDataBound += new GridViewRowEventHandler(workGrid_RowDataBound);
TemplateField BtnTmpField = new TemplateField();
BtnTmpField.ItemTemplate = new GridViewTemplate(ListItemType.Item, "Modify", "Command");
BtnTmpField.HeaderTemplate = new GridViewTemplate(ListItemType.Header, "Modify", "Command");
BtnTmpField.EditItemTemplate = new GridViewTemplate(ListItemType.EditItem, "...", "Command");
workGrid.Columns.Clear();
workGrid.Columns.Add(BtnTmpField);
for (int workCnt = 0; workCnt < dtWorksGrid.Columns.Count; workCnt++)
{
TemplateField ItemTmpField = new TemplateField();
// create HeaderTemplate
ItemTmpField.HeaderTemplate = new GridViewTemplate(ListItemType.Header, dtWorksGrid.Columns[workCnt].ColumnName, dtWorksGrid.Columns[workCnt].DataType.Name);
ItemTmpField.HeaderStyle.Width = Unit.Pixel(145);
// create ItemTemplate
ItemTmpField.ItemTemplate = new GridViewTemplate(ListItemType.Item, dtWorksGrid.Columns[workCnt].ColumnName, dtWorksGrid.Columns[workCnt].DataType.Name);
//create EditItemTemplate
ItemTmpField.EditItemTemplate = new GridViewTemplate(ListItemType.EditItem, dtWorksGrid.Columns[workCnt].ColumnName, dtWorksGrid.Columns[workCnt].DataType.Name);
// then add to the GridView
workGrid.Columns.Add(ItemTmpField);
}
workGrid.DataSource = dtWorksGrid;
workGrid.DataBind();
workGrid.AllowPaging = true;
workGrid.PageSize = 5;
workGrid.PageIndexChanging += new GridViewPageEventHandler(workGrid_PageIndexChanging);
推荐答案
您是否使用过页面索引更改事件...?
参见链接
问候
koolprasad2003:)
Have you used page index changing event...?
see this Link
regards
koolprasad2003 :)
这篇关于分页甚至不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文