Dynamically update the master page

K

King Coffee

Hi,

I would like to set some form tag attributes. The form is in the mater page.
The asp ID tags (Text2 and Button3) are in the main content selection of a
web form page. The code below does not work but it shows my intend. How can
I dynamically update the master page form from a child page?

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<script type="text/javascript">
document.getElementById('form1').setAttribute("defaultfocus",
$get('Text2'));
document.getElementById('form1').setAttribute("defaultbutton",
$get('Button3'));
</script>
</asp:Content>

King
 
G

Göran Andersson

King said:
Hi,

I would like to set some form tag attributes. The form is in the mater
page. The asp ID tags (Text2 and Button3) are in the main content
selection of a web form page. The code below does not work but it shows
my intend. How can I dynamically update the master page form from a
child page?

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<script type="text/javascript">
document.getElementById('form1').setAttribute("defaultfocus",
$get('Text2'));
document.getElementById('form1').setAttribute("defaultbutton",
$get('Button3'));
</script>
</asp:Content>

King

You can't set the properties of the HtmlForm control by setting them on
the form element that it has rendered. The DefaultFocus and
DefaultButton properties are server side properties, they don't exist in
the html element form.

You have to set the properties using server side code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top