[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 623
  • Last Modified:

Gridview tab order

I found Gridview tab order works only with a dataset/table datasource and not with an objectdatasource. I have been pulling my hair over this for days. Please advise. Thanks.
0
ksfok
Asked:
ksfok
  • 2
  • 2
1 Solution
 
Ajay SharmaCommented:
u can do it in the itemDataBound event of dataview

first take a session variable so that u can retrive and set value anywhere.
in page load
      Session("tabs") = 0

Private Sub dg_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dg.ItemDataBound

        e.Item.Cells(0).TabIndex = CInt(Session("tabs")) + 1
        e.Item.Cells(1).TabIndex = CInt(Session("tabs")) + 2
        e.Item.Cells(2).TabIndex = CInt(Session("tabs")) + 3
        Session("tabs") = CInt(Session("tabs")) + 3

End Sub

so this would be called on every data row created in dataview and every column will be got its Tabindex.

just replace e.Item.Cells(0).TabIndex with e.Item.Cells(0).controles(0).TabIndex if u have  a control in the column.
0
 
ksfokAuthor Commented:
What's the event for a gridview?
0
 
ksfokAuthor Commented:
Now I have made the tabbing work. But when the cell is tabbed to, the focus is set on the cell and not on the textbox inside. I have to manually place the mouse over the cell to set focus on the textbox. How can the focus be set on the textbox when the tab reaches the cell?
Thanks.
0
 
Ajay SharmaCommented:
use   e.Item.Cells(0).Controls(0).TabIndex = CInt(Session("tabs")) + 1
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now