473,320 Members | 1,909 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Using derived/inherited components in C# / ASP.NET

Hi.

Following the example at
http://www.codeproject.com/useritems...asp?print=true, I have a
datagrid descendant class that shows a JavaScript confirm dialog before
deleting a row from the grid.

My first two questions are:

(i) Currently this class is in my project namespace.

I suppose it's a good idea to have this in some more generic custom
namespace so I can use this in several ASP.NET projects.

What is the best way to take this component and do that?

(ii) Currently using the component involves dropping a normal datagrid on
the webform and then editing the HTML view of the designer

<%@ Register tagprefix="dg" Namespace="iCARnetWebInterface"
Assembly="iCARnetWebInterface" %>

and

<asp:Datagrid . . .> </asp:datagrid> to <dg:DelDataGrid> . . .
</DelDataGrid> eg:

<dg:DelDataGrid id="DataGrid1" runat="server" CellPadding="3"
BackColor="White" BorderWidth="1px"
BorderStyle="None" BorderColor="#CCCCCC" AllowPaging="True"
PageSize="8" AutoGenerateColumns="False"
Height="168px" Width="448px">
.. . .
</dg:DelDataGrid></TD>

How would I go about making this modified/descended/inherited component
available from the toolbar, so it registers itself and inserts itself into
the webform appropriately?

My third question would be how I would modify the grid so that if JavaScript
isn't available on the browser, it posts back a confirm message including a
yes and a no button and only deletes on the yes button being pressed.

All juicy questions, it seems . . .

Thanks!

Lauchlan M
Nov 17 '05 #1
2 1793
Lauchlan,

Please see my responses inline:
Hi.

Following the example at
http://www.codeproject.com/useritems...asp?print=true, I have a
datagrid descendant class that shows a JavaScript confirm dialog before
deleting a row from the grid.

My first two questions are:

(i) Currently this class is in my project namespace.

I suppose it's a good idea to have this in some more generic custom
namespace so I can use this in several ASP.NET projects.

What is the best way to take this component and do that?

You can create a new class library and then create a new component and
inherit the datagrid class. Then make your modifications as you have in the
current code.

(ii) Currently using the component involves dropping a normal datagrid on
the webform and then editing the HTML view of the designer

<%@ Register tagprefix="dg" Namespace="iCARnetWebInterface"
Assembly="iCARnetWebInterface" %>

and

<asp:Datagrid . . .> </asp:datagrid> to <dg:DelDataGrid> . . .
</DelDataGrid> eg:

<dg:DelDataGrid id="DataGrid1" runat="server" CellPadding="3"
BackColor="White" BorderWidth="1px"
BorderStyle="None" BorderColor="#CCCCCC" AllowPaging="True"
PageSize="8" AutoGenerateColumns="False"
Height="168px" Width="448px">
. . .
</dg:DelDataGrid></TD>

How would I go about making this modified/descended/inherited component
available from the toolbar, so it registers itself and inserts itself into
the webform appropriately?
If you create the new component and inherit the original datagrid class
as I mentioned above you will be able to add the new component to the
toolbar by right clicking on the toolbar, clicking the browse button in the
window that pops up, and navigating to the compiled .dll file of the new
component.

My third question would be how I would modify the grid so that if JavaScript isn't available on the browser, it posts back a confirm message including a yes and a no button and only deletes on the yes button being pressed.


To get you started I've modified the RequiredFieldValidator so that it
validates CheckBoxLists. It is inserting customized javascript on the page,
can be added to the toolbar, etc. It might give you some idea of how to get
started.

Just go to the code library and click the CheckBoxListValidator button in
the menu on the left.

Sincerely,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
Nov 17 '05 #2
Lauchlan,

Please see my responses inline:
Hi.

Following the example at
http://www.codeproject.com/useritems...asp?print=true, I have a
datagrid descendant class that shows a JavaScript confirm dialog before
deleting a row from the grid.

My first two questions are:

(i) Currently this class is in my project namespace.

I suppose it's a good idea to have this in some more generic custom
namespace so I can use this in several ASP.NET projects.

What is the best way to take this component and do that?

You can create a new class library and then create a new component and
inherit the datagrid class. Then make your modifications as you have in the
current code.

(ii) Currently using the component involves dropping a normal datagrid on
the webform and then editing the HTML view of the designer

<%@ Register tagprefix="dg" Namespace="iCARnetWebInterface"
Assembly="iCARnetWebInterface" %>

and

<asp:Datagrid . . .> </asp:datagrid> to <dg:DelDataGrid> . . .
</DelDataGrid> eg:

<dg:DelDataGrid id="DataGrid1" runat="server" CellPadding="3"
BackColor="White" BorderWidth="1px"
BorderStyle="None" BorderColor="#CCCCCC" AllowPaging="True"
PageSize="8" AutoGenerateColumns="False"
Height="168px" Width="448px">
. . .
</dg:DelDataGrid></TD>

How would I go about making this modified/descended/inherited component
available from the toolbar, so it registers itself and inserts itself into
the webform appropriately?
If you create the new component and inherit the original datagrid class
as I mentioned above you will be able to add the new component to the
toolbar by right clicking on the toolbar, clicking the browse button in the
window that pops up, and navigating to the compiled .dll file of the new
component.

My third question would be how I would modify the grid so that if JavaScript isn't available on the browser, it posts back a confirm message including a yes and a no button and only deletes on the yes button being pressed.


To get you started I've modified the RequiredFieldValidator so that it
validates CheckBoxLists. It is inserting customized javascript on the page,
can be added to the toolbar, etc. It might give you some idea of how to get
started.

Just go to the code library and click the CheckBoxListValidator button in
the menu on the left.

Sincerely,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
Nov 17 '05 #3

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

Similar topics

0
by: Dave | last post by:
Hi all, To repro the problem I am having: 1. Create a class that derives from System.Windows.Forms.Form 2. Add some controls such as buttons and labels (wherever you want). The default values...
0
by: Lauchlan M | last post by:
Hi. Following the example at http://www.codeproject.com/useritems/ooaspnet.asp?print=true, I have a datagrid descendant class that shows a JavaScript confirm dialog before deleting a row from...
10
by: Chad Miller | last post by:
I currently have a base form that I inherit. The base for has a custom event. The event will not raise threw the inherited form. I was wondering if events work threw inheritance or should I use...
4
by: dbuchanan | last post by:
Is the following behavior normal? Both the 'Protected sub' in the inherited form and the 'Private Shadows sub' in the derived form fires. My interpretation of MSDN help on the topic "Shadows"...
3
by: dbuchanan | last post by:
Can inherited code call derived code? If so how. I have identical 'generic' code that I am repeating again and again in several derived form because I don't know how to get inherited code to call...
8
by: Mike C# | last post by:
Suppose I have a base class "foo". Another class, "bar" derives from it. Base class "foo" has a method called "rob_the_liquor_store()", and the inherited class "bar" overrides this method with one...
4
by: SteveT | last post by:
I have written a control that does some base functionality. I then wrote a control that inherits from it so that I can make several unique versions which behave differently. To do this the...
53
by: Hexman | last post by:
Hello All, I'd like your comments on the code below. The sub does exactly what I want it to do but I don't feel that it is solid as all. It seems like I'm using some VB6 code, .Net2003 code,...
61
by: Sanders Kaufman | last post by:
I'm wondering if I'm doing this right, as far as using another class object as a PHP class property. class my_baseclass { var $Database; var $ErrorMessage; var $TableName; var $RecordSet;...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.