D
dgk
I was working on a simple app and I would use some javascript to set
the focus:
Dim sb As StringBuilder = New StringBuilder
sb.Append("<script language = 'javascript'>")
sb.Append(" document.getElementById('txtWarrant').focus()")
sb.Append("</script>")
ClientScript.RegisterStartupScript(Me.GetType, "focus",
sb.ToString)
Now I've added a Masterpage and the same code generates an error:
Microsoft JScript runtime error: 'document.getElementById(...)' is
null or not an object
which I guess means that the masterpage is causing the script to
execute before txtWarrant is created. Is there a way around this?
the focus:
Dim sb As StringBuilder = New StringBuilder
sb.Append("<script language = 'javascript'>")
sb.Append(" document.getElementById('txtWarrant').focus()")
sb.Append("</script>")
ClientScript.RegisterStartupScript(Me.GetType, "focus",
sb.ToString)
Now I've added a Masterpage and the same code generates an error:
Microsoft JScript runtime error: 'document.getElementById(...)' is
null or not an object
which I guess means that the masterpage is causing the script to
execute before txtWarrant is created. Is there a way around this?