I am in the middle of putting together a web application using SQL Server 2005 and .Net Framework 3.5 using VB. The design that I have been given uses a number of gridview to display data, which has a number of columns which are common across the pages.
What I am seeing here is repetitive code across the pages, which would be far better to be moved to a class. Also there will be image buttons on the gridviews, which have command arguments on them, and theses will also be common across the board.
My question is whether I could move all the common bits in my rowbound method to a class object which I can call from within it for each gridview? Is this possible, and if so, how do you do it?
All that I expect to move to the class will be taking a couple of attributes from the database, and checking their value and with the results showing the correct icon for the image buttons. In addition to this, would be a number of methods that will be associated
with the command arguments for the image buttons. Again, I wouldn't want to repeat this code over each page.
Can someone please explain to me how, I can do this. I have tried to do this myself, but I am unable to get my class to see or use the gridview methods in the form in which it is being used.
AndyMoireASP
Member
53 Points
742 Posts
Making a class for a Rowbound Method
Mar 26, 2009 09:46 PM|LINK
Hi
I am in the middle of putting together a web application using SQL Server 2005 and .Net Framework 3.5 using VB. The design that I have been given uses a number of gridview to display data, which has a number of columns which are common across the pages. What I am seeing here is repetitive code across the pages, which would be far better to be moved to a class. Also there will be image buttons on the gridviews, which have command arguments on them, and theses will also be common across the board.
My question is whether I could move all the common bits in my rowbound method to a class object which I can call from within it for each gridview? Is this possible, and if so, how do you do it?
All that I expect to move to the class will be taking a couple of attributes from the database, and checking their value and with the results showing the correct icon for the image buttons. In addition to this, would be a number of methods that will be associated with the command arguments for the image buttons. Again, I wouldn't want to repeat this code over each page.
Can someone please explain to me how, I can do this. I have tried to do this myself, but I am unable to get my class to see or use the gridview methods in the form in which it is being used.
Thanks