enctype="multipart/form-data" for MasterPage


G

Guest

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
 
Ad

Advertisements

G

Guest

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

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

Advertisements

S

Steven Cheng[MSFT]

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.
 

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

Top