Asp.net中的网格视图 [英] Grid View in Asp.net

查看:65
本文介绍了Asp.net中的网格视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Asp.net中获取网格视图行号.....

How to get Grid View Row number in Asp.net.....

推荐答案

Container.DataItemIndex 会帮助你。

Container.DataItemIndex would help you.
<columns>
    <asp:templatefield headertext="Row Number" itemstyle-width="100" xmlns:asp="#unknown">
        <itemtemplate>
            <asp:label id="lblRowNumber" text="<%# Container.DataItemIndex + 1 %>" runat="server" />
        </itemtemplate>
    </asp:templatefield>
    <asp:boundfield datafield="Name" headertext="Name" itemstyle-width="150" xmlns:asp="#unknown" />
    <asp:boundfield datafield="Country" headertext="Country" itemstyle-width="150" xmlns:asp="#unknown" />
</columns>



阅读本文此处 [ ^ ]



-KR


Read this article here[^]

-KR


protected void gridView1_RowDataBound (对象发送者,GridViewRowEventArgs e)

{

if(e.Row.RowType == DataControlRowType.DataRow)

{

int index = e.Row.RowIndex;

}

}
protected void gridView1_RowDataBound(Object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
int index = e.Row.RowIndex;
}
}


这篇关于Asp.net中的网格视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆