473,324 Members | 2,254 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,324 software developers and data experts.

extending Datagrid - problem

Hi folks,
first off, I'm using Framework vs 1.1 with ASP.net and C#

I'm trying to extend the System.Web.UI.Webcontrols.DataGrid, and the only
thing I want to extend is the Render method (in order to add <thead> and
<tbody> elements)

so far so good

I've placed this code into another project called CustomControls with a
namespace of CustomControls, I've also called it DataGrid so mine is
CustomControls.DataGrid

<%@ Register TagPrefix="msdn" Namespace="CustomControls"
Assembly="CustomControls" %>
since the namespace is called "CustomControls" and the assembly will become
CustomControls.dll

if I do this in the HTML view

<msdn:DataGrid id="dgCustom" runat="server" AutoGenerateColumns="true">

</msdn:DataGrid>

I never get the variable to appear in the code view and I have an 'error
creating control' view in the pseudo browser window.
my question:

once you actually subclass a datagrid, how do you use your own subclass on
an .aspx page? (I referenced the component from the toolbox and still I can't
drag and drop it), I don't think the problem is anything as trivial as a
missing Using or the Dll not being referenced inside the web project...those
are both correctly set up

Regards and thanks in advance,
CharlesA


Apr 19 '06 #1
2 1226
Couple of things come to mind here:

First, it's probably not a good idea to name a custom control derived from
Datagrid as "DataGrid" - too much chance for ambiguous reference errors to
pop up. Better to call it "CustomDataGrid" or "DataGridEx".

Next, in order for a control to be able to show up in the designer surface
it needs to have a <ToolboxData ...> directive. Do you have this?

Hope that helps.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"CharlesA" wrote:
Hi folks,
first off, I'm using Framework vs 1.1 with ASP.net and C#

I'm trying to extend the System.Web.UI.Webcontrols.DataGrid, and the only
thing I want to extend is the Render method (in order to add <thead> and
<tbody> elements)

so far so good

I've placed this code into another project called CustomControls with a
namespace of CustomControls, I've also called it DataGrid so mine is
CustomControls.DataGrid

<%@ Register TagPrefix="msdn" Namespace="CustomControls"
Assembly="CustomControls" %>
since the namespace is called "CustomControls" and the assembly will become
CustomControls.dll

if I do this in the HTML view

<msdn:DataGrid id="dgCustom" runat="server" AutoGenerateColumns="true">

</msdn:DataGrid>

I never get the variable to appear in the code view and I have an 'error
creating control' view in the pseudo browser window.
my question:

once you actually subclass a datagrid, how do you use your own subclass on
an .aspx page? (I referenced the component from the toolbox and still I can't
drag and drop it), I don't think the problem is anything as trivial as a
missing Using or the Dll not being referenced inside the web project...those
are both correctly set up

Regards and thanks in advance,
CharlesA


Apr 19 '06 #2
I completeley agree Peter re the naming, I argued the very same point with a
colleague and backed down...

this is the declaration I had at the top
namespace CustomControls
{
[ToolboxData("<{0}:DataGrid runat=server ></{0}:DataGrid>")]
public class DataGrid : System.Web.UI.WebControls.DataGrid
{
protected override void Render(HtmlTextWriter output)
{

Cheers
CharlesA
Apr 19 '06 #3

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

Similar topics

3
by: Eli Daniel | last post by:
Hi, I am relative new to Python. Please tell me if the following is possible. I have a command line shell written in C. This shell executes some commands which I would like to import to the...
4
by: Matt | last post by:
Hi, I've been thinking about how to do this, but can't think of a solution. I have a class that is derived from System.Web.UI.WebControls.DataGrid which works a treat, but I'd like to extend...
5
by: SoftLion | last post by:
Hi, I've created a default asp.net web page and dragged a DataGrid inside it. I would like to create a simple custom class derived from DataGrid to hide all relevant code in it, instead of putting...
3
by: Jon Paugh | last post by:
Hi All, I want to extend the datagrid by adding some paging options that do not come out of the box. When I create a class that extends datagrid, and then use it on my page (it's a custom...
3
by: Marco Meoni | last post by:
Hi all! I've a problem with a C++ class that has to be included in a python application. One way to do it is Extending and Embedding the Python Interpreter Now i have 2 questions 1) Is there a...
5
by: vbgunz | last post by:
Hello everyone. I own two books. Learning Python and Python in a nutshell. When cross referencing the two books to try and clarify the ideas behind extending methods and delegates, this is where...
3
by: katis | last post by:
Hi all :) Is it posible in xsd to change only minOccurs value of element in complex type by extending this type? The problem I'm trying to solve is this: I have two complex types -...
0
by: axapta | last post by:
Hi Group, I'm new to .net and would like to know the steps to code a datagrid. I've got a datgrid on my form which I've populated with some data from a SP. I would like to extend this so that...
0
by: Tim Spens | last post by:
--- On Fri, 6/27/08, Tim Spens <t_spens@yahoo.comwrote: I think I know where the problem is but I'm unsure how to fix it. When I call Register_Handler(...) from python via...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
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.