且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在asp.net的单独页面中显示gridview的每一行?

更新时间:2023-10-07 15:08:16

您可以将查询字符串与要显示的项目的ID发送到下一页,并且可以使用此ID轻松添加数据

享受
ashok kumar saini
You can send a query string to next page with the id of the item that you want to show and with this id you can fatch data easily

Enjoy
ashok kumar saini


执行页面大小属性pagesize = 1,那么它将逐行更改页面更改
do page size properties pagesize=1 then it will change row by row page change


如果我们要更改数据网格,我们必须使用行数据绑定事件.

受保护的void GridView1_RowDataBound(对象发送者,GridViewRowEventArgs e)
{

如果(e.Row.RowType == DataControlRowType.DataRow)
{
//我们只对包含数据的行感兴趣
//获取对用于对行进行数据绑定的数据的引用
DataRowView drv =(DataRowView)e.Row.DataItem;
int breakAfterRecords = 1;
如果(e.Row.RowIndex%breakAfterRecords == 0)
e.Row.Cells [0] .Text =<已移除的类=" \"pagebreak \""=" =">;



}

}
if we want change the perticular row in a data grid we have to use row data bound event.

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{

if (e.Row.RowType == DataControlRowType.DataRow)
{
//We''re only interested in Rows that contain data
//get a reference to the data used to databound the row
DataRowView drv = (DataRowView)e.Row.DataItem;
int breakAfterRecords = 1;
if (e.Row.RowIndex % breakAfterRecords == 0)
e.Row.Cells[0].Text="<removed class="\" pagebreak\""="">";



}

}