Dynamically update the master page

  • Thread starter Thread starter King Coffee
  • Start date Start date
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
 
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.
 
Back
Top