enctype="multipart/form-data" for MasterPage

Discussion in 'ASP .Net' started by =?Utf-8?B?QWxleCBNYWdoZW4=?=, Aug 14, 2007.

  1. I have a MasterPage. The MasterPage actually contains the <form> tag which is
    used throughout the site.

    On just certain pages that use that MasterPage, I need the "enctype" for the
    <form> tag to be set to:
    enctype="multipart/form-data"

    On the rest of the pages, I do not need this.

    How can my specific ASPX page that uses the MasterPage change the
    MasterPage's <form enctype=...> just for that page? Or is there a better way?

    Alex
     
    =?Utf-8?B?QWxleCBNYWdoZW4=?=, Aug 14, 2007
    #1
    1. Advertising

  2. just set it in code behind inside the pages where it needs to be set:

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


    "Alex Maghen" wrote:

    > I have a MasterPage. The MasterPage actually contains the <form> tag which is
    > used throughout the site.
    >
    > On just certain pages that use that MasterPage, I need the "enctype" for the
    > <form> tag to be set to:
    > enctype="multipart/form-data"
    >
    > On the rest of the pages, I do not need this.
    >
    > How can my specific ASPX page that uses the MasterPage change the
    > MasterPage's <form enctype=...> just for that page? Or is there a better way?
    >
    > Alex
     
    =?Utf-8?B?U2VyZ2V5IFBvYmVyZXpvdnNraXk=?=, Aug 15, 2007
    #2
    1. Advertising

  3. Hi Alex,

    As Sergey has suggested, you can use code to programmatically set the
    attributes of <form> tag. And you can put the code in a proper page event
    such as "Init" event. e.g.

    ==========
    public partial class test_TestContentPage : System.Web.UI.Page
    {
    protected void Page_Init(object sender, EventArgs e)
    {
    this.Form.Enctype = "multipart/form-data";
    }
    ........
    ============

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead


    This posting is provided "AS IS" with no warranties, and confers no rights.
     
    Steven Cheng[MSFT], Aug 15, 2007
    #3
    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. Matt
    Replies:
    8
    Views:
    144,654
    zeeshanakhter2009
    May 26, 2012
  2. Duncan
    Replies:
    0
    Views:
    1,531
    Duncan
    Feb 24, 2006
  3. Matt
    Replies:
    1
    Views:
    11,300
    David Dorward
    Oct 12, 2004
  4. Stimp
    Replies:
    1
    Views:
    935
    Karl Seguin [MVP]
    Nov 9, 2006
  5. Kevin DeValck
    Replies:
    1
    Views:
    783
    7stud --
    May 17, 2011
Loading...

Share This Page