473,699 Members | 2,702 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

I feel I am stupid

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 ?

Nov 19 '05 #1
4 1149
Hi ad!

Well, I am feeling extremely stupid at the moment too. You can see my post
at "Help!! RedirectFromLog inPage . . ." 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.
--
Sandy
"ad" wrote:
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 ?

Nov 19 '05 #2
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.P age
-- 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
-------------------

Nov 19 '05 #3
ad
I think you are my GOD!
I trid to test your answer, but fail.
Could you give me a more detail example?
"MasterGaur av" <ga**********@g mail.com>
???????:11***** *************** **@g47g2000cwa. googlegroups.co m...
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.P age
-- 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
-------------------

Nov 19 '05 #4
What did you try?

My email is gaurav[dot]vaish @ gmail[dot]com. Send me basic skeleton of
your code (2 aspx pages and their code behind)... I may be able to help
out directly from there....
--
Cheers,
Gaurav Vaish
http://mastergaurav.blogspot.com
http://mastergaurav.org
-------------------

Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
1628
by: sebb | last post by:
I'm kind of newbie to programming, but I thought of something and I want some opinions on that. It's about a new instruction block to do some cycles. I thought about that because it's not very easy to program a cycle. Here is a simple example : b=0
119
4591
by: rhat | last post by:
I heard that beta 2 now makes ASP.NET xhtml compliant. Can anyone shed some light on what this will change and it will break stuff as converting HTML to XHTML pages DO break things. see, http://www.alistapart.com/articles/betterliving/ I read on http://msdn.microsoft.com/netframework/default.aspx?pull=/library/en-us/dnnetdep/html/netfxcompat.asp It said they changed stuff like this
2
2303
by: Lampa Dario | last post by:
Hi, where is this stupid error in this program? When I execute it, i receive a segmentation fault error. #include <stdio.h> int main(int argc, char *argv, char *env) { int i=0; int l=0; int word=0; char *querystring; querystring=malloc(sizeof(char)*100000); if (getenv("QUERY_STRING")==NULL)
10
15289
by: Fei Li | last post by:
Hi, If I'm not stupid for this, then the design of FolderBrowserDialog is very stupid. It only allow to strat browing from several predefined folder(Environment.SpecialFolder). What can I do if I want to start from any folder I want?
2
1341
by: louise raisbeck | last post by:
hi, i am trying to get to a point where i can use intellisense. i have everything else sorted apart from my codebehind. Is it me or does .NET seem really biased towards vb.net? even though i have default langauge set to c# in my web.config it still creates all codebehind files as aspx.vb files. I have put this in the page directive at the top <%@ Page CodeBehind="mypage.aspx.cs" Language="c#" AutoEventWireup="false"...
5
1712
by: Guoqi Zheng | last post by:
I think I have this kind of problem very often, now it is really making me crazy. VS.NET always want to change my html code. Ok, that is fine as long as Vs.Net can ask my confirmaton first. For example, I have below in header part of my html page. <base href="http://localhost/more/"> When I click save, VS.NET change it back to <base href="http://localhost/more"> automatically without asking me or anything. It just remove the last "/" by...
20
2790
by: mc | last post by:
I may be opening a can of worms and don't want to start a religious war, but... What features of Java do Java programmers miss when working in C#? Other than, of course, great portability. C# has more limited cross-platform portability (Mono). I'm thinking more about data structures and ways to express algorithms.
0
8613
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9172
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9032
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8880
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7745
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4374
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3054
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2344
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.