views:

71

answers:

1

Please tell me your favorite trick and tips to me. I want to collect so much knowledge as I can. And I think it's the best way to hear it from experts and amateur developers.

*1. HTML FORM Tag + Attribute "multipart/form-data" and HttpPostedFileBase *

I cloud tell you something about html form tag. If you use form tag in MasterPage of your MVC project. And you need in one only View one extra attribute for Image Uload like: "multipart/form-data". Be carefull, look at your Code-Source, because you could have 2 Form tags and your parameter of type HttpPostedFileBase can always be null. I solved it so: Activated "multipart/form-data" in form just if this View will called. i did it in codebehind and I know it is not nice solution.

protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            Form.Enctype = "multipart/form-data";
        }
A: 

Using Html.Serialize helper method to persist view models between pages and of course MVCContrib.

Darin Dimitrov
thank you! it nice to share knowledge
Ragims