GridView获取当前行号,设置空值提示

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" EmptyDataText="没有数据"
                                Width="100%" DataKeyNames="Id,YillNum" OnRowDataBound="GridView1_RowDataBound"
                                GridLines="None" CssClass="gridview">
                                <Columns>

<asp:TemplateField HeaderText="序号">
                                        <ItemTemplate>
                                            <asp:Label ID="Label1" runat="server" Text="<%# Container.DataItemIndex + 1 %>"></asp:Label>
                                        </ItemTemplate>
                                        <HeaderStyle CssClass="col_index" />
                                        <ItemStyle CssClass="col_index" />
                                    </asp:TemplateField>    

                               </Columns>
                            </asp:GridView>

posted on 2009-06-11 08:49  ToKens  阅读(560)  评论(0编辑  收藏  举报