kyuss
03-06-2003, 04:54 AM
Hello all, :)
I'm going nuts with this: I've made a web page with ASP.NET (loader.aspx) which has only a placeholder control.
Then I've made some web user controls, which are my different views (ascx files).
I then load dinamically the ascx I need into the loader page.
But the problem comes when trying to access a certain textbox or control in the view with javascript... I don't have no <body> or <form> tag, because they are in the loader page.
So, for example, I want to set the focus on a specific textbox of View1.ascx just when loading. If it was an aspx page that would be easy, just using the onload event of the form or body tag and calling the textbox.focus(). But since I don't have those tags.... How can I do that?
The html of the files explained:
There is the loader file which I use to load all my views - ascx web user control files. The loader has only a placeholder:
<body>
<form id="Form1" method="post" runat="server">
<asp:PlaceHolder id="phdr" runat="server">
</asp:PlaceHolder>
</form>
</body>
the ascx control (my view), the file that i load into the placeholder:
<%@ Control Language="c#" AutoEventWireup="false" Codebehind="view1.ascx.cs" ... %>
<asp: panel id="pnl1" ... runat="server">
<DIV ... ms_positioning="GridLayout">
<asp:TextBox id="txtName" ... runat="server" ></asp:TextBox>
... some other controls here
</DIV>
</asp: panel>
...some other panels which I turn visible or invisible depending on the user input progress.
So, how can i put JavaScript code in the ascx file to run when the panel or div is first loaded and set the focus on a textbox inside one of the divs or panels of the ascx file?
Thank you very much in advance ,' )
kyuss.
I'm going nuts with this: I've made a web page with ASP.NET (loader.aspx) which has only a placeholder control.
Then I've made some web user controls, which are my different views (ascx files).
I then load dinamically the ascx I need into the loader page.
But the problem comes when trying to access a certain textbox or control in the view with javascript... I don't have no <body> or <form> tag, because they are in the loader page.
So, for example, I want to set the focus on a specific textbox of View1.ascx just when loading. If it was an aspx page that would be easy, just using the onload event of the form or body tag and calling the textbox.focus(). But since I don't have those tags.... How can I do that?
The html of the files explained:
There is the loader file which I use to load all my views - ascx web user control files. The loader has only a placeholder:
<body>
<form id="Form1" method="post" runat="server">
<asp:PlaceHolder id="phdr" runat="server">
</asp:PlaceHolder>
</form>
</body>
the ascx control (my view), the file that i load into the placeholder:
<%@ Control Language="c#" AutoEventWireup="false" Codebehind="view1.ascx.cs" ... %>
<asp: panel id="pnl1" ... runat="server">
<DIV ... ms_positioning="GridLayout">
<asp:TextBox id="txtName" ... runat="server" ></asp:TextBox>
... some other controls here
</DIV>
</asp: panel>
...some other panels which I turn visible or invisible depending on the user input progress.
So, how can i put JavaScript code in the ascx file to run when the panel or div is first loaded and set the focus on a textbox inside one of the divs or panels of the ascx file?
Thank you very much in advance ,' )
kyuss.