Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Master page and form

Reply
Thread Tools

Master page and form

 
 
Shelly
Guest
Posts: n/a
 
      09-26-2007
First: I have a master page that has the form tag in it. My content page,
on one occasion, needs a different type of form (uploading files needs
encytype="multipart/form-data"). I solved this by duplicating the master
page and changing the form tag -- but this seems to defeat the purpose of
the master page. (Changing something in one would require changing in the
other for consistency). Is there some way to override the specific of the
form tag while in the content page?

Second: I some of my content pages can get quite large. I would like to be
able to take sections of a large page and place that content in a separate
file and then include that file. Is this possible in aspx? As an example,
suppose I have one area that has a whole set of checkboxes for
property_type_1 and another with a whole set of other checkboxes for
property_type_2 and each of these is extensive code. Can I put the
property_type_x in separate files and simply include them somehow in the
content page? It makes for much easier viewing of the code.

Shelly


 
Reply With Quote
 
 
 
 
Mark Rae [MVP]
Guest
Posts: n/a
 
      09-26-2007
"Shelly" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> Is there some way to override the specific of the form tag while in the
> content page?


((HtmlForm)Master.FindControl("form1")).Enctype... ........

> Can I put the property_type_x in separate files


Yup - in ASP.NET, they're called UserControls:
http://www.google.co.uk/search?sourc...ET+UserControl


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

 
Reply With Quote
 
 
 
 
Shelly
Guest
Posts: n/a
 
      09-26-2007

"Mark Rae [MVP]" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> "Shelly" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>
>> Is there some way to override the specific of the form tag while in the
>> content page?

>
> ((HtmlForm)Master.FindControl("form1")).Enctype... ........
>
>> Can I put the property_type_x in separate files


Mark, the Lone Ranger, once again to the rescue.

> Yup - in ASP.NET, they're called UserControls:
> http://www.google.co.uk/search?sourc...ET+UserControl


I'll investigate this.

Thanks again.

Shelly


 
Reply With Quote
 
bruce barker
Guest
Posts: n/a
 
      09-26-2007
if you use <input type=file runat=server> (HtmlInputFile), it
automatically sets enctype="multipart/form-data" if it has not been set
to a value. so you do not need to specify the attribute at all in the
master page. you can also set it in the code behind with:

this.Page.Form.Enctype="multipart/form-data";


user controls (ascx) are asp.net's version of includes.

-- bruce (sqlwork.com)

Shelly wrote:
> First: I have a master page that has the form tag in it. My content page,
> on one occasion, needs a different type of form (uploading files needs
> encytype="multipart/form-data"). I solved this by duplicating the master
> page and changing the form tag -- but this seems to defeat the purpose of
> the master page. (Changing something in one would require changing in the
> other for consistency). Is there some way to override the specific of the
> form tag while in the content page?
>
> Second: I some of my content pages can get quite large. I would like to be
> able to take sections of a large page and place that content in a separate
> file and then include that file. Is this possible in aspx? As an example,
> suppose I have one area that has a whole set of checkboxes for
> property_type_1 and another with a whole set of other checkboxes for
> property_type_2 and each of these is extensive code. Can I put the
> property_type_x in separate files and simply include them somehow in the
> content page? It makes for much easier viewing of the code.
>
> Shelly
>
>

 
Reply With Quote
 
Mark Rae [MVP]
Guest
Posts: n/a
 
      09-26-2007
"Shelly" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

>>> Is there some way to override the specific of the form tag while in the
>>> content page?

>>
>> ((HtmlForm)Master.FindControl("form1")).Enctype... ........



Or even:

Page.Form.Enctype="multipart/form-data"


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

 
Reply With Quote
 
clintonG
Guest
Posts: n/a
 
      09-27-2007
The #include directive is still supported and often easier to use in content
pages than User Controls.

I think User Controls are best used when other controls which generate HTML
must be reused but when the content being reused in a content page is simply
text the #include directive remains the more efficient choice for me.

Its a judgement call and this context as I've explained is the way I've
chosen to use both methodologies to my advantage.

<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://clintongallagher.metromilwaukee.com/




"Mark Rae [MVP]" <(E-Mail Removed)> wrote in message
news:e%(E-Mail Removed)...
> "Shelly" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>
>>>> Is there some way to override the specific of the form tag while in the
>>>> content page?
>>>
>>> ((HtmlForm)Master.FindControl("form1")).Enctype... ........

>
>
> Or even:
>
> Page.Form.Enctype="multipart/form-data"
>
>
> --
> Mark Rae
> ASP.NET MVP
> http://www.markrae.net



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Access Master Page Controls from page.aspx doesn't inherit from master SerpentKiss2010 ASP .Net 0 04-06-2011 02:46 PM
Setting the value of a Master page's control's property using a property of the Master page Nathan Sokalski ASP .Net 25 03-04-2010 03:42 AM
Can a master page be built from another master page Zeba ASP .Net 1 02-22-2007 10:55 AM
Cross Page Post Back When Using Mixture of Master Pages and Non-Master Pages Jason@webbit.com ASP .Net 1 05-16-2006 02:00 PM
seeking servlet "Master" keep getting "Master/servlet/Master" not found. Tomcat 5.0.25 Doug McCann Java 1 08-05-2004 09:16 PM



Advertisments