请帮我解释一下,这段代码中没一句代码的意思,谢谢! 请帮我解释一下,这段代码中没一句代码的意思,谢谢! protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Cells[0].Text = Convert.ToString(e.Row.DataItemIndex + 1); } } 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 GridView1_RowDataBoundGridView1 的 行绑定事件e.Row.RowType == DataControlRowType.DataRow判断当前行的行类型 是否为 数据行 e.Row.Cells[0].Text 当前行的第一列的文本e.Row.DataItemIndex + 1当前行的行号------------------------------------------简单的写法<ItemTemplate> <%#Container.DataItemIndex + 1 %></ItemTemplate>放在第一列 protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e){if (e.Row.RowType == DataControlRowType.DataRow)//判断当前行是否数据行{e.Row.Cells[0].Text = Convert.ToString(e.Row.DataItemIndex + 1);//将当前行的第一列的文本设置为当前行的行号+1}} [求助]关于gridview中dropdownlist的问题 截取字符串中html的链接地址!!!!!!!!!!!!!!!!!!!!!1 乱码问题 在masterpage中使用sitemapDataSource绑定treeview ~页面刷新后应该在哪里save state 求个关于排序的思路 你们都不知道什么是ASP!!!! 认为自己绝对知道什么是ASP的,不服的进来. 求助datalist,datagrid问题 急用 当SQL SERVER的表记录上万时,前台网页上显示就很慢? 好怪的问题阿,窗口初始化的时候报错!!!! 关于写值的问题!!!!!!!! datarowview
简单的写法
<ItemTemplate>
<%#Container.DataItemIndex + 1 %>
</ItemTemplate>放在第一列
{
if (e.Row.RowType == DataControlRowType.DataRow)//判断当前行是否数据行
{
e.Row.Cells[0].Text = Convert.ToString(e.Row.DataItemIndex + 1);//将当前行的第一列的文本设置为当前行的行号+1
}
}