Custom DataGrid

Discussion in 'ASP .Net Web Controls' started by Hermit Dave, Oct 31, 2003.

  1. Hermit Dave

    Hermit Dave Guest

    Hello people,

    This is my second post. Someone answer it...
    Okay I had issues with using DataGrid control that comes by default. Had
    some paging issues and also needed sort and filter to be added. Realised
    that I need to write the code myself. So I got myself to building my custom
    control.
    It is not a composite control. I am drawing everything.
    Was earlier thinking of using Repeater control but that would mean asking
    the end user (me again) to do some extra stuff plus it was a pain cause sort
    is normally done on column names and with repeater they aren't a part of it.
    (meant scattered code if I don't make my own control)
    anyhow
    planning to use the ITemplate object to get info which would be similar to
    DataGrid definition.
    The problem is that I have know clue as to how Columns property is
    implemented. Looked up the documentation and its some sealed class. Which
    means not helpful at all.
    * And how can I allow the user to use property builder to create columns and
    specify paging info etc. What do I need to do ? any idea ?

    Thanks a lot,

    Regards,

    HD
    Hermit Dave, Oct 31, 2003
    #1
    1. Advertising

  2. Hermit Dave

    James Radke Guest

    HD,

    Why would you need to create your own control to use custom paging, sorting
    and filtering?

    You can do all of these items fine with the existing datagrid: although
    this does require that you do create some of your own code in the codebehind
    module. I have several pages where I have 5 or so textbox/drop down lists
    that allow the user to select their filtering criteria, and also enable the
    headings of some of the columns to allow them to change the sort order from
    asc to desc, etc...

    What kinds of problems were you having? What, exactly, were you trying to
    do? More information would be helpful....

    Jim

    "Hermit Dave" <> wrote in message
    news:OxiGJN$...
    > Hello people,
    >
    > This is my second post. Someone answer it...
    > Okay I had issues with using DataGrid control that comes by default. Had
    > some paging issues and also needed sort and filter to be added. Realised
    > that I need to write the code myself. So I got myself to building my

    custom
    > control.
    > It is not a composite control. I am drawing everything.
    > Was earlier thinking of using Repeater control but that would mean asking
    > the end user (me again) to do some extra stuff plus it was a pain cause

    sort
    > is normally done on column names and with repeater they aren't a part of

    it.
    > (meant scattered code if I don't make my own control)
    > anyhow
    > planning to use the ITemplate object to get info which would be similar to
    > DataGrid definition.
    > The problem is that I have know clue as to how Columns property is
    > implemented. Looked up the documentation and its some sealed class. Which
    > means not helpful at all.
    > * And how can I allow the user to use property builder to create columns

    and
    > specify paging info etc. What do I need to do ? any idea ?
    >
    > Thanks a lot,
    >
    > Regards,
    >
    > HD
    >
    >
    James Radke, Oct 31, 2003
    #2
    1. Advertising

  3. Hermit Dave

    Hermit Dave Guest

    Hello Jim,

    Okay the problem is that at work we set up a monitoring system using ASP.net
    Portal Starter kit.
    When i try using Paging with Datagrid and the type is Numeric Pages with
    values 10 with more to next set and previous set. When i move to the next
    set of pager links and say click on page 17 it does pull the right records
    but the pager is reset to 1 to 10 and if there are say more than 20 pages
    there's no way to move beyond unless i change the code to do custom paging.
    Okay i know DataGrid is configurable and okay it can supprt lot of different
    things but have to write code behind for everything and at the end of the
    day if i am to use it in more than one page... duplicate the effort. The
    second reason why i got onto designing a control is that the datagrid is
    currently used in 8 odd pages and most dont have enough records for now to
    have paging issues but sort and filter is required.
    Plus with control i can set it to capture even and so dont have to write any
    code in code behind.

    So what i did was started with plain vanilla table... used table to display
    the records (at the end of the day even a data grid generates table
    structure to display) Plus my own PostBack events for the column and handle
    it on the control itself. The problem i am facing is that i am forced to use
    the Column Headers in the Datasource. Plus i can't define say specially link
    columns to say open the edit page. Stuff like that

    <asp:DataGrid id=DataGrid1 runat="server" AutoGenerateColumns="False">
    <Columns>
    <asp:BoundColumn HeaderImageUrl="Order ID"
    DataField="orderid"></asp:BoundColumn>
    <asp:BoundColumn HeaderImageUrl="Order Date"
    DataField="orderdate"></asp:BoundColumn>
    <asp:HyperLinkColumn Text="Order Details" Target="_blank"
    DataNavigateUrlField="orderid"
    DataTextField="orderid"
    NavigateUrl="OrderDetail.aspx"></asp:HyperLinkColumn>
    </Columns>
    </asp:DataGrid>

    okay now Columns is a property on the DataGrid control. How would you go
    about creating something like that,
    Will probably get around to working on it in the monring. Thanks,

    HD

    "James Radke" <> wrote in message
    news:O0Mcsu$...
    > HD,
    >
    > Why would you need to create your own control to use custom paging,

    sorting
    > and filtering?
    >
    > You can do all of these items fine with the existing datagrid: although
    > this does require that you do create some of your own code in the

    codebehind
    > module. I have several pages where I have 5 or so textbox/drop down lists
    > that allow the user to select their filtering criteria, and also enable

    the
    > headings of some of the columns to allow them to change the sort order

    from
    > asc to desc, etc...
    >
    > What kinds of problems were you having? What, exactly, were you trying to
    > do? More information would be helpful....
    >
    > Jim
    >
    > "Hermit Dave" <> wrote in message
    > news:OxiGJN$...
    > > Hello people,
    > >
    > > This is my second post. Someone answer it...
    > > Okay I had issues with using DataGrid control that comes by default. Had
    > > some paging issues and also needed sort and filter to be added. Realised
    > > that I need to write the code myself. So I got myself to building my

    > custom
    > > control.
    > > It is not a composite control. I am drawing everything.
    > > Was earlier thinking of using Repeater control but that would mean

    asking
    > > the end user (me again) to do some extra stuff plus it was a pain cause

    > sort
    > > is normally done on column names and with repeater they aren't a part of

    > it.
    > > (meant scattered code if I don't make my own control)
    > > anyhow
    > > planning to use the ITemplate object to get info which would be similar

    to
    > > DataGrid definition.
    > > The problem is that I have know clue as to how Columns property is
    > > implemented. Looked up the documentation and its some sealed class.

    Which
    > > means not helpful at all.
    > > * And how can I allow the user to use property builder to create columns

    > and
    > > specify paging info etc. What do I need to do ? any idea ?
    > >
    > > Thanks a lot,
    > >
    > > Regards,
    > >
    > > HD
    > >
    > >

    >
    >
    Hermit Dave, Nov 1, 2003
    #3
    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. VB Programmer
    Replies:
    1
    Views:
    389
    Axel Dahmen
    Nov 3, 2003
  2. Jonah Olsson
    Replies:
    1
    Views:
    565
    Scott Allen
    Apr 5, 2005
  3. =?Utf-8?B?SW1hciBTcGFhbmphYXJz?=

    Databinding to custom properties of a custom class in ASP.NET 2

    =?Utf-8?B?SW1hciBTcGFhbmphYXJz?=, Apr 20, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    582
    =?Utf-8?B?SW1hciBTcGFhbmphYXJz?=
    Apr 20, 2005
  4. Andreas Klemt
    Replies:
    0
    Views:
    274
    Andreas Klemt
    Oct 8, 2003
  5. Terry Holland
    Replies:
    9
    Views:
    205
    Steven Cheng[MSFT]
    Oct 28, 2005
Loading...

Share This Page