1

**我有带有 2 个文本框的 Gridview..我已经为第一个 texbox 行设置了标签索引...它

除了最后一行之外的所有行都可以正常工作。它在最后一行之前停止。

它没有到达最后一行......

请帮助....**

<asp:GridView ID="GridView1" runat="server">
                    <AlternatingRowStyle BackColor="White" />
                    <Columns>
                        <asp:BoundField DataField="st_id" HeaderText="Id" SortExpression="st_id" />
                        <asp:TemplateField HeaderText="Attended-OutOff">
                            <ItemTemplate>
                            <table>
                            <tr>
                            <td>
                                <asp:TextBox ID="tbattendedlectures"  runat="server" Height="27px" Width="32px"></asp:TextBox>
                                </td>

                  <td>
                                     <asp:TextBox ID="tbtotalattendence" runat="server" Height="27px" Width="32px" ReadOnly="true"></asp:TextBox>
                 </td>
                  </tr>
                  </table>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                 </asp:GridView>

    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {


                Label batch = (Label)e.Row.FindControl("lbbatch");
                batch.Text = dpbatchname.SelectedItem.Text.ToString();
                Label subject = (Label)e.Row.FindControl("lbsubject");
                subject.Text = dpsubjname.SelectedItem.Text.ToString();

                Label sessional = (Label)e.Row.FindControl("lbcurrentsessional");
                sessional.Text = dpsessional.SelectedItem.Text.ToString();
                TextBox total = (TextBox)e.Row.FindControl("tbtotalattendence");
                total.Text = tbnooflecture.Text.ToString();
               /* TextBox attendence = (TextBox)e.Row.FindControl("tbattendedlectures");
                attendence.Text = tbnooflecture.Text.ToString();
                */



                SetTabIndexes();
            }
        }

    private void SetTabIndexes()
    {
        short currentTabIndex = 0;
        GridView1.TabIndex = ++currentTabIndex;

        foreach (GridViewRow gvr in GridView1.Rows)
        {

            TextBox inputField1 = (TextBox)gvr.FindControl("tbattendedlectures");
            inputField1.TabIndex = ++currentTabIndex;

        }


    }
4

0 回答 0