62,262
社区成员
发帖
与我相关
我的任务
分享protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Header)
{
for (int i = 0; i < e.Row.Cells.Count;i++ )
{
Response.Write("<li>列名=" + e.Row.Cells[i].Text);
}
}
if (e.Row.RowType == DataControlRowType.DataRow)
{
for (int i = 0; i < e.Row.Cells.Count; i++)
{
Response.Write("<li>内容=" + e.Row.Cells[i].Text);
}
}
}
protected void gvdata_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
string strA = gvdata.Columns[i].HeaderText.ToString();//第i列列明
string strB = e.Row.Cells[i].Text.ToString();//第i列列值
}
}