Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting Row in Datagrid-Scroll

Status
Not open for further replies.

toddw607

Programmer
Apr 2, 2007
55
US
I have a datagrid in ASP.NET using VB.NET code which, when loaded it takes a parameter from the URL called DexNumb. When this parameter is brought it, it highlights the entire row Red and makes it bold but if the datagrid is long and some elements can only be viewed by scrolling down, it will not go straight to the elements, the user must scroll down in order to view them. Here is the method that is launched from the datagrid on Page_Load:

Code: ( text )
Protected Sub PopulateIPC_OnItemDataBound(ByVal sender as System.Object, ByVal e As DataGridItemEventArgs) Handles PopulateIPC.ItemDataBound
Dim JScrpt As String
If e.Item.Cells(0).Text = DexNumb Then
e.Item.BackColor = System.Drawing.Color.Red
e.Item.Font.Bold=True
JScrpt = "<script language=JavaScript>"
JScrpt += "e.Item.Cells.focus();"
JScrpt += "<"
JScrpt += "/script>"
Page.RegisterStartupScript("Popup", JScrpt)
End If
End Sub



The Javascript is contained in the method but it works the same way with or without it. Any thoughts on a quick fix for this? TIA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top