**我有2个文本框的Gridview ..我已设置第1个texbox行的选项卡索引...它
对于除最后一行之外的所有行都正常工作..它在最后一行之前停止..
它没有达到最后一排......
plz,help .... **
<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;
}
}