locked
How to create Reusable Grid in ASP.Net RRS feed

  • Question

  • User1081236289 posted

    Hi,

                I have the 60 pages and 60 tables in my project. Each page has the grid, each grid has the common actions as follows Show the existing record , add new record , update the record, delete the record .  

     

                Each page refers different tables so that we have written the code for separately for each page.

     

    My questions as follows

     

    1. How should I avoid the code redundancy?
    2. How should I design the reusable coding architecture?
    3. Which functionality to full fill the grid reusability in all pages
      1. For example user control , custom control or any thing else . 



    Thanks

    Mayil.M

    Tuesday, December 21, 2010 6:19 AM

Answers

  • User-873890331 posted

    Hi,


    Please Download the sample code from here.

    www.mymom.in/MVC.rar

    Let me know if you have any doubts .


    Thanks & Regards

    Shwetamber

    India

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, December 22, 2010 1:42 AM
  • User1081236289 posted

    Hi Shwetamber,

     

                                Thanks a lot for your reply. Before I go to MVC I need the following information

     

    1. What are all the unique advantages in MVC application? 
    2. How about server installation? Is there any special instructions to deploy the files in server
    3. I need some sample programs to under stand the MVC 

    Thanks

    Mayil.M

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, December 22, 2010 4:35 AM
  • User-873890331 posted

    >> What are all the unique advantages in MVC application?

    1) It is an good approch to communicate with Database server. Write your connection string in Web.Config file. In case if database path will change then you will no need to change connection string in every page. Just change in Web.Config and It is apply to all methods.

    2)  In the Controller class and AdminManager Class, You will ensure that connection and SqlTransaction will be closed . This will overcome the Connection pooling problems in Asp.net .

    3) In the AdminManager class the command object will be resused if it is not disposed. It Saves the Memory in ASP.net . Otherwise too many objects will initialised in buffer and they will not used in project.

    4) Your website performence also incresed.

    5) Using the Properties instead of direct variables will create security in Your Code.

    >> How about server installation? Is there any special instructions to deploy the files in server?

    No need the server installation. Just put the App_Code Folder in your website. If you deploy the whole source code on hosting server then App_Code folder will not change. If you published your website the App_Code folder will compiled and added to your bin folder automatically.

    You doesn't need to do anything extra.

    >> I need some sample programs to under stand the MVC.

    I had sent you the sample application. Change your connection string in web.Config and write the query in AdminManager.cs Methods. Run the application and put break points. You can see what happening between classes.

    Thanks & Regards

    Shwetamber Chourey

    India

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, December 22, 2010 5:09 AM

All replies

  • User-873890331 posted

    Hi,

    You can Use MVC Architecture for avoid code redundancy. It is easy to understand and reuse. In short- Create the public class in your App_Code Folder and Create Insert , Update , Delete And Select Methods in it . At the front end call the appropriate method from your page.

    Thanks & regards

    Shwetamber

    India

    Tuesday, December 21, 2010 6:39 AM
  • User1081236289 posted

    Hi Shwetamber,

                                    Thanks a lot for your reply .  I will try to create the MVC architecture . do you have any samples please upload. 

    Tuesday, December 21, 2010 7:39 AM
  • User-873890331 posted

    Hi,


    Please Download the sample code from here.

    www.mymom.in/MVC.rar

    Let me know if you have any doubts .


    Thanks & Regards

    Shwetamber

    India

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, December 22, 2010 1:42 AM
  • User1081236289 posted

    Hi Shwetamber,

     

                                Thanks a lot for your reply. Before I go to MVC I need the following information

     

    1. What are all the unique advantages in MVC application? 
    2. How about server installation? Is there any special instructions to deploy the files in server
    3. I need some sample programs to under stand the MVC 

    Thanks

    Mayil.M

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, December 22, 2010 4:35 AM
  • User-873890331 posted

    >> What are all the unique advantages in MVC application?

    1) It is an good approch to communicate with Database server. Write your connection string in Web.Config file. In case if database path will change then you will no need to change connection string in every page. Just change in Web.Config and It is apply to all methods.

    2)  In the Controller class and AdminManager Class, You will ensure that connection and SqlTransaction will be closed . This will overcome the Connection pooling problems in Asp.net .

    3) In the AdminManager class the command object will be resused if it is not disposed. It Saves the Memory in ASP.net . Otherwise too many objects will initialised in buffer and they will not used in project.

    4) Your website performence also incresed.

    5) Using the Properties instead of direct variables will create security in Your Code.

    >> How about server installation? Is there any special instructions to deploy the files in server?

    No need the server installation. Just put the App_Code Folder in your website. If you deploy the whole source code on hosting server then App_Code folder will not change. If you published your website the App_Code folder will compiled and added to your bin folder automatically.

    You doesn't need to do anything extra.

    >> I need some sample programs to under stand the MVC.

    I had sent you the sample application. Change your connection string in web.Config and write the query in AdminManager.cs Methods. Run the application and put break points. You can see what happening between classes.

    Thanks & Regards

    Shwetamber Chourey

    India

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, December 22, 2010 5:09 AM