Master page and form

Discussion in 'ASP .Net' started by Shelly, Sep 26, 2007.

  1. Shelly

    Shelly Guest

    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
     
    Shelly, Sep 26, 2007
    #1
    1. Advertising

  2. Mark Rae [MVP], Sep 26, 2007
    #2
    1. Advertising

  3. Shelly

    Shelly Guest

    "Mark Rae [MVP]" <> wrote in message
    news:%...
    > "Shelly" <> wrote in message
    > news:...
    >
    >> 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?sour...1T4GGIH_en-GBGB220GB220&q=ASP.NET UserControl


    I'll investigate this.

    Thanks again.

    Shelly
     
    Shelly, Sep 26, 2007
    #3
  4. Shelly

    bruce barker Guest

    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
    >
    >
     
    bruce barker, Sep 26, 2007
    #4
  5. "Shelly" <> wrote in message
    news:...

    >>> 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
     
    Mark Rae [MVP], Sep 26, 2007
    #5
  6. Shelly

    clintonG Guest

    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]" <> wrote in message
    news:e%...
    > "Shelly" <> wrote in message
    > news:...
    >
    >>>> 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
     
    clintonG, Sep 27, 2007
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Doug McCann
    Replies:
    1
    Views:
    1,079
    William Brogden
    Aug 5, 2004
  2. Replies:
    1
    Views:
    3,251
    PeterKellner
    May 16, 2006
  3. Zeba
    Replies:
    1
    Views:
    524
    Mark Rae
    Feb 22, 2007
  4. Nathan Sokalski
    Replies:
    25
    Views:
    1,469
    Nathan Sokalski
    Mar 4, 2010
  5. SerpentKiss2010
    Replies:
    0
    Views:
    2,517
    SerpentKiss2010
    Apr 6, 2011
Loading...

Share This Page