When I edit in a datagrid, the focus is not set to the item I want to edit. So I want a javascript snippet that will focus on that item (ex Datagrid1.item.id or E.item.id) . How can i retrieve the ID of a row?<BR><BR>I wanna do something like that.<BR><BR> Protected Sub DataEdit(ByVal Sender As Object, _<BR> ByVal E As DataGridCommandEventArgs) Handles DataGrid1.EditCommand<BR><BR> Dim strBuilder As StringBuilder = New StringBuilder()<BR><BR> strBuilder.Append("&#060;script language=&#039;javascript&#039;&#062;")<BR> strBuilder.Append("function setFocus() {")<BR> strBuilder.Append("document.getElementById(Datagri d1.item.ID).focus();}")<BR> strBuilder.Append(" window.onload=setFocus;")<BR> strBuilder.Append("&#060;/script&#062;")<BR> RegisterClientScriptBlock("Focus", strBuilder.ToString)<BR><BR>end sub