473,387 Members | 1,510 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Master page and form

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
Sep 26 '07 #1
5 2118
"Shelly" <sh************@asap-consult.comwrote in message
news:13*************@corp.supernews.com...
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

Sep 26 '07 #2

"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
"Shelly" <sh************@asap-consult.comwrote in message
news:13*************@corp.supernews.com...
>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
Sep 26 '07 #3
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

Sep 26 '07 #4
"Shelly" <sh************@asap-consult.comwrote in message
news:13*************@corp.supernews.com...
>>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

Sep 26 '07 #5
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]" <ma**@markNOSPAMrae.netwrote in message
news:e%****************@TK2MSFTNGP03.phx.gbl...
"Shelly" <sh************@asap-consult.comwrote in message
news:13*************@corp.supernews.com...
>>>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

Sep 27 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Martijn Saly | last post by:
Hi there, I've created a master page with some controls on it, a Calendar control among others. Now depending on the date(s) selected, the content page needs to be updated. In the masterpage...
3
by: lanem | last post by:
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.
3
by: ivanpais | last post by:
Hi, I have a Web User Control, Lets say "Foo.ascx", that contains a button "btnFoo". I have a Master Page "Bar.master", that has a label "lblBar". This label is exposed by a public property...
2
by: Paul | last post by:
Hello: I am struggling with something that would seem to be very easy. I am using a master page. On the content page (which includes the master page), I have a form with a submit input type...
2
by: SR | last post by:
I have started a web site using ASP.NET 2.0. I would like to centralize all of my classes in a StyleSheet but I cannot figure out how to link the StyleSheet to a Content Page since there is no...
0
by: Managed Code | last post by:
Hello All, Here is my issue and thanks in advance for any assistance. I have a base page with a dropdownlist that fires an event with the selected index. The content page catches the event and...
4
by: Boris Yeltsin | last post by:
OK, on my Master Page I have a control: <a id="hypTabAccount" href="#" runat="server">Account</a> Now, in the code-behind (Root.master.vb) I can refer to it simply thus: ...
4
by: Suresh | last post by:
Is there any way to access the custom properties of a master page from the aspx form? I know the custom properties of a master page can be accessed from the aspx.cs partial class by specifying...
6
by: mike | last post by:
I'm having a problem getting AJAX working with a master page. I have created a new website using the AJAXControlToolkit template and default.aspx as follows. <%@ Page Language="C#"...
5
by: xlar54 | last post by:
I have a very simple 2.0 website (framework), that uses a master page...not. I added the default.aspx page as a webcontent form, with the master page as it's master page, but the master page is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.