473,765 Members | 2,059 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.W ebcontrols.Data Grid, 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="Cust omControls"
Assembly="Custo mControls" %>
since the namespace is called "CustomControls " and the assembly will become
CustomControls. dll

if I do this in the HTML view

<msdn:DataGri d id="dgCustom" runat="server" AutoGenerateCol umns="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 1245
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.W ebcontrols.Data Grid, 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="Cust omControls"
Assembly="Custo mControls" %>
since the namespace is called "CustomControls " and the assembly will become
CustomControls. dll

if I do this in the HTML view

<msdn:DataGri d id="dgCustom" runat="server" AutoGenerateCol umns="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.W ebControls.Data Grid
{
protected override void Render(HtmlText Writer 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
1301
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 python shell. Here is an example command from my shell: openconnection www.yahoo.com 12 2000 So I've created a dll (myshell_d.dll) according to the manual
4
3432
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 the DataGridColumnCollection class (property of DataGrid) just a fraction by allowing a string indexer. i.e. rather than using myDataGrid.Columns.Visible = false;
5
1135
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 the code (especially for the events) in the _default class. This class is called DGMGrid2. I replaced the declaration : protected System.Web.UI.WebControls.DataGrid DataGrid1; with protected DGMGrid2 DataGrid1;
3
1190
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 control),the designer window now makes all the properties of the datagrid red. Error is "the active schema does not support...".
3
2052
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 one-file version of this tutorial? 2) Is there anyone that can help me with this problem? The class is attached. Thanks all. Marco
5
3832
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 confusion veered it's ugly head :( Learning Python explains on page 324: Class Interface Techniques (21.3.3 in the ebook) the following is an extender method. ''' #################################### '''
3
3677
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 - "TextField" and "FileChooser". Here is definition of "TextField" <xsd:complexType name="TextField">
0
671
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 when a record is clicked in the datagrid, this record opens up in another form. Any help most appreciated. TIA
0
2114
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 callback.setHandler1(callback1) this only seems to affect pythons ability to trigger an "event" in c. PyObject *Handler is always NULL even after I call Register_Handler(...). I thought there was some magic here that was assigning the pointer *Handler to my python...
0
9399
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
10007
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...
1
9957
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9835
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
8832
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
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3924
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
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.