Master pages and forms

G

Guest

Do you put your form on the master page or in each individual page? I use a
master page for most of my site. Should the form tag be in the master page?
Thanks.
 
G

Guest

Sometimes I want to do things in the form tag per the specific page though.
Like, I want to set the defaultfocus in the form on the page, but since the
form is in the master page I can't do that. Each page has different
controls, so I can't set the defaultfocus in the master page.
 
G

Guest

You can still do manipulations of the objects on the master page from the
content page. Refer to this article for detail:
http://msdn2.microsoft.com/en-us/library/c8y19k6h.aspx

As for setting the default focus, it was discussed in serveral threads on
this forum, just search for "DefaultFocus" or "DefaultButton". Basically
instead of setting the property named DefaultFocus to a value, you would find
the control within the form and call its focus() method programmatically, e.g.

HtmlForm frmForm1 = (HtmlForm)Master.FindControl("form1");
TextBox txt1 = (TextBox)frmForm1.FindControl("TextBox1");
txt1.Focus();

http://msdn2.microsoft.com/en-us/library/ms178232.aspx
 

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,780
Messages
2,569,608
Members
45,244
Latest member
cryptotaxsoftware12

Latest Threads

Top