Wednesday, 16 May 2012

MVC and Webform Tradeoff

MVC or Web Forms?

Now that you've got a basic understanding of what ASP.NET MVC is and what it offers, you may be wondering if MVC is the way to go with your future ASP.NET applications. Let's look at a few scenarios that might help you decide if MVC is right for your next ASP.NET project.
Choose MVC if . . .
  • You are well-versed in the architecture of MVC. If you aren't comfortable with how to design a controller, MVC probably isn't a good choice.
  • You want full control over the HTML that is rendered in the browser and you can afford the development time and overhead to do all of your own markup.
  • You need to create efficient unit tests for your user interface without the overhead of the entire managed runtime, etc.
  • You want full control over how your URLs are formed.
Choose web forms if . . .
  • You are not familiar with designing MVC applications.
  • You need to minimize development time.
  • You want a feature-rich user-interface (such as GridViews, etc.) to display data with rich interaction without substantial development investment.
  • You are already invested in server controls, either from your own development or from 3rd parties.

Tuesday, 1 May 2012

Export Dynamicly added rows into excel

Export Dynamicly added rows into excel

Problem : I have tried Exporting GridView to Excel but observed that the Dynamically added Row to Gridview is not exported to excel.

Answer :
 Actually when you click on export to excel button its postback methos will destroy your dynamic data.
I think in every post back your not binding the dynamically added rows. Try to find the control which cause the postback and bind the data once again.
 Or
Call once again that method which is adding dynamic rows.
Example: