I feel I am stupid

  • Thread starter Thread starter ad
  • Start date Start date
A

ad

I have 50 web page in my project, there always a DataGrid in every page.

The PreRender event is the same all of the DataGrid
I have copy/paste the code of PreRender many many times.

I think there must be a method instead of copy/paste

How can I reuese the event for all the DataGrids ?
 
Hi ad!

Well, I am feeling extremely stupid at the moment too. You can see my post
at "Help!! RedirectFromLoginPage . . ." just five posts beneath yours. Any
suggestions, please help if you can.

At any rate, I am wondering if you have tried making your datagrid with the
added code into a user control. You can then include that user control in
each page.
 
I assume that you are using ASP.Net 1.1

In that case, create a base-page class. Right now, all 50 pages would
be having 50 different classes from which the aspx-pages inherit.

Make a base class, like BasePage. Here's the final hierarchy:


BasePage : System.Web.UI.Page
-- override PreRender (common functionality for DataGrid)

SomePage : BasePage
-- override PreRender (specific to this page. Don't forget to call
base.PreRender)

somePage.aspx inherits "SomePage" (using <%@ Page ... %> directive).


HTH


--
Cheers,
Gaurav Vaish
http://mastergaurav.blogspot.com
http://mastergaurav.org
-------------------
 
I think you are my GOD!
I trid to test your answer, but fail.
Could you give me a more detail example?
 

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

Back
Top