hi
i write this code :
VB.NET Code
Private Sub DG1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DG1.ItemDataBound
If (e.Item.ItemType = ListItemType.Item) Or (e.Item.ItemType = ListItemType.AlternatingItem) Then
CType(e.Item.FindControl("btnEdit"), ImageButton).Attributes.Add("onclick", "SaveObjID(this.id)")
CType(e.Item.FindControl("btnDelete"), ImageButton).Attributes.Add("onclick", "SaveObjID(this.id)")
End If
End Sub
JAVASCRITP CODE (within asp.net page)
function SaveObjID(OBJID)
{
document.getElementById('ObjectID').value = OBJID ;
}
function Scroll()
{
document.getElementById(document.getElementById('ObjectID').value).scrollIntoView();
}
where the Scroll function is invoked on the body.onload .
On postback , into the Scroll function the document.getElementById('ObjectID').value is correct but the whole instruction return NULL
The stange is that if i save explicitly (into the SaveObjID function) an object id, it works!
Any suggest?
thanks
i write this code :
VB.NET Code
Private Sub DG1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DG1.ItemDataBound
If (e.Item.ItemType = ListItemType.Item) Or (e.Item.ItemType = ListItemType.AlternatingItem) Then
CType(e.Item.FindControl("btnEdit"), ImageButton).Attributes.Add("onclick", "SaveObjID(this.id)")
CType(e.Item.FindControl("btnDelete"), ImageButton).Attributes.Add("onclick", "SaveObjID(this.id)")
End If
End Sub
JAVASCRITP CODE (within asp.net page)
function SaveObjID(OBJID)
{
document.getElementById('ObjectID').value = OBJID ;
}
function Scroll()
{
document.getElementById(document.getElementById('ObjectID').value).scrollIntoView();
}
where the Scroll function is invoked on the body.onload .
On postback , into the Scroll function the document.getElementById('ObjectID').value is correct but the whole instruction return NULL
The stange is that if i save explicitly (into the SaveObjID function) an object id, it works!
Any suggest?
thanks