How can I extend the ASP.NET DataGrid ?

Discussion in 'ASP .Net' started by Rick, Feb 11, 2006.

  1. Rick

    Rick Guest

    If I create a class that inherits from the asp.net datagrid, and the
    enhancements only relate to the codebehind, what does the grid's html look
    like in design mode? I mean, whereas I might have an unadorned DataGrid as
    such...

    <ASP:DataGrid id="aspDataGrid" runat="server" ...
    templates and stuff
    </ASP:DataGrid>

    and I create a class like so:

    public class SuperGrid : DataGrid
    {
    ...
    }

    can I write in the HTML designer:

    <ASP:SuperGrid id="myGrid" runat="server"...
    templates and stuff
    </ASP:SuperGrid>
    Rick, Feb 11, 2006
    #1
    1. Advertising

  2. Rick,
    The "SuperGrid"'s markup in the ASPX page should look identical to the
    DataGrid class that you've derived it from, unless you have overridden any of
    the Render methods.
    Peter

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




    "Rick" wrote:

    > If I create a class that inherits from the asp.net datagrid, and the
    > enhancements only relate to the codebehind, what does the grid's html look
    > like in design mode? I mean, whereas I might have an unadorned DataGrid as
    > such...
    >
    > <ASP:DataGrid id="aspDataGrid" runat="server" ...
    > templates and stuff
    > </ASP:DataGrid>
    >
    > and I create a class like so:
    >
    > public class SuperGrid : DataGrid
    > {
    > ...
    > }
    >
    > can I write in the HTML designer:
    >
    > <ASP:SuperGrid id="myGrid" runat="server"...
    > templates and stuff
    > </ASP:SuperGrid>
    >
    >
    >
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=, Feb 11, 2006
    #2
    1. Advertising

  3. Rick

    Sonu Kapoor Guest

    Sonu Kapoor, Feb 11, 2006
    #3
  4. Rick

    Rick Guest

    Thanks to both of you. Much appreciated!

    <Sonu Kapoor> wrote in message news:...
    > Besides Peters suggestion, I would recommend that you checkout the
    > following article written by Scott Mitchell.
    >
    > http://aspnet.4guysfromrolla.com/articles/072104-1.aspx
    >
    > The article creates a new Datagrid called "PrettyDataGrid" which is
    > extended from the normal DataGrid class.
    >
    > Hope it helps.
    >
    > Sonu Kapoor [MVP]
    > ---
    > Posted via www.DotNetSlackers.com
    Rick, Feb 11, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steve - DND

    Can you extend HtmlControls?

    Steve - DND, May 18, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    973
    Natty Gur
    May 18, 2004
  2. Paul Rubin

    Can't extend function type

    Paul Rubin, Oct 7, 2005, in forum: Python
    Replies:
    5
    Views:
    452
    Paul Rubin
    Oct 7, 2005
  3. Charlie Miller
    Replies:
    0
    Views:
    328
    Charlie Miller
    Dec 9, 2006
  4. Sergio Florez M.

    Extend the DataGrid

    Sergio Florez M., Nov 29, 2004, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    113
    Sergio Florez M.
    Nov 29, 2004
  5. Sergio Florez M.

    Extend the DataGrid 2

    Sergio Florez M., Nov 29, 2004, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    112
    Sergio Florez M.
    Nov 29, 2004
Loading...

Share This Page