T
tshad
I have a page where I have the Body tag set up as:
<body id="myBody" runat="server" >
This allows me to set the focus to different attributes on my page. I have
all my Body tags set to this.
I just tried to strip out the main part of the page and make it a control
(to allow different looks and feels). I have the following statement in the
control:
myBody.Attributes.Add("onLoad","document.forms[0].UserName.focus()")
And I get the error:
**************************************************
Compilation Error
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.
Compiler Error Message: BC30451: Name 'myBody' is not declared.
Source Error:
Line 9: dim IsCheckResumes as Boolean = true
Line 10: if not IsPostBack
Line 11:
myBody.Attributes.Add("onLoad","document.forms[0].UserName.focus()")
Line 12: end if
Line 13: End Sub
*****************************************************
How can I get this control to be able to access an outside tag?
All my pages that use this control would always have the tag set up this
way.
The aspx file is:
**************************************************************
<%@ Page Language="VB" trace="false" ContentType="text/html"
ResponseEncoding="iso-8859-1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ Register TagPrefix="fts" TagName="Logon" Src="test.ascx" %>
<html>
<head>
<title>Login</title>
</head>
<body id="myBody" runat="server" >
<form id="addForm" runat="server">
<fts:Logon runat="Server"/>
</form>
</html>
**************************************************************
The ascx file is:
**************************************************************
<%@ Import Namespace="System.Web.Mail" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="MyFunctions" %>
<%@ Import Namespace="RolesBasedAuthentication" %>
<script runat="server" >
Sub Page_Load(sender as Object, e as EventArgs)
dim IsCheckResumes as Boolean = true
if not IsPostBack
myBody.Attributes.Add("onLoad","document.forms[0].UserName.focus()")
end if
End Sub
</script>
<asp:textbox id="UserName" TextMode="SingleLine" Columns="25" runat="server"
/>
<asp:RequiredFieldValidator
ControlToValidate="UserName"
Text="User Name Required"
runat="server" />
**************************************************************
Thanks,
Tom
<body id="myBody" runat="server" >
This allows me to set the focus to different attributes on my page. I have
all my Body tags set to this.
I just tried to strip out the main part of the page and make it a control
(to allow different looks and feels). I have the following statement in the
control:
myBody.Attributes.Add("onLoad","document.forms[0].UserName.focus()")
And I get the error:
**************************************************
Compilation Error
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.
Compiler Error Message: BC30451: Name 'myBody' is not declared.
Source Error:
Line 9: dim IsCheckResumes as Boolean = true
Line 10: if not IsPostBack
Line 11:
myBody.Attributes.Add("onLoad","document.forms[0].UserName.focus()")
Line 12: end if
Line 13: End Sub
*****************************************************
How can I get this control to be able to access an outside tag?
All my pages that use this control would always have the tag set up this
way.
The aspx file is:
**************************************************************
<%@ Page Language="VB" trace="false" ContentType="text/html"
ResponseEncoding="iso-8859-1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ Register TagPrefix="fts" TagName="Logon" Src="test.ascx" %>
<html>
<head>
<title>Login</title>
</head>
<body id="myBody" runat="server" >
<form id="addForm" runat="server">
<fts:Logon runat="Server"/>
</form>
</html>
**************************************************************
The ascx file is:
**************************************************************
<%@ Import Namespace="System.Web.Mail" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="MyFunctions" %>
<%@ Import Namespace="RolesBasedAuthentication" %>
<script runat="server" >
Sub Page_Load(sender as Object, e as EventArgs)
dim IsCheckResumes as Boolean = true
if not IsPostBack
myBody.Attributes.Add("onLoad","document.forms[0].UserName.focus()")
end if
End Sub
</script>
<asp:textbox id="UserName" TextMode="SingleLine" Columns="25" runat="server"
/>
<asp:RequiredFieldValidator
ControlToValidate="UserName"
Text="User Name Required"
runat="server" />
**************************************************************
Thanks,
Tom