How to create a datagrid on the fly ?

Discussion in 'ASP .Net Web Controls' started by chak, Aug 27, 2003.

  1. chak

    chak Guest

    Hi,

    Any examples / pointers on how to render a datagrid on the fly in a asp.net
    page, based on dynamic parameters ?

    Thanks.
    chak, Aug 27, 2003
    #1
    1. Advertising

  2. chak

    Teemu Keiski Guest

    Creating dynamically:
    http://www.dotnetbips.com/displayarticle.aspx?id=66

    More dg articles @ www.datagridgirl.com/articles.aspx

    Perhaps you meant creating on the fly? I don't see any benefits rendering it
    on-the-flya s it is rendered if dg just is part of Controls collection on
    the Page.

    --
    Teemu Keiski
    MCP,Designer/Developer
    Mansoft tietotekniikka Oy
    http://www.mansoft.fi

    AspInsiders Member, www.aspinsiders.com
    ASP.NET Forums Moderator, www.asp.net
    AspAlliance Columnist, www.aspalliance.com


    "chak" <> kirjoitti viestissä
    news:...
    > Hi,
    >
    > Any examples / pointers on how to render a datagrid on the fly in a

    asp.net
    > page, based on dynamic parameters ?
    >
    > Thanks.
    >
    >
    Teemu Keiski, Aug 28, 2003
    #2
    1. Advertising

  3. chak

    Dave Guest

    Excellent reference site!
    The reason why someone would need to create a DG (or DL) on the fly is that
    they may need to
    use variables to change things like the headers. The inability to use
    code-behind variables inside server controls - the
    single greatest handicap of ASP.NET - can be overcome by building your
    literals from variables via
    dynamic DG creation.
    For example, say you wanted to do the following:

    <asp:HyperLink id="HyperLink1" runat="server" NavigateUrl='<%#
    "../index.aspx?catID=" & currentCat & "|" &
    DataBinder.Eval(Container.DataItem, "CategoryID")%>' Text='<%#
    DataBinder.Eval(Container.DataItem, "CategoryName") %>'></asp:HyperLink>

    where currentCat was some variable declared in a code behind.
    It is impossible to do because you cannot use variables from a code-behind
    in a server control (i.e. 'currentCat' would never contain a value no matter
    where it was declared). The only workaround is to dynamically create your
    control.

    "Teemu Keiski" <> wrote in message
    news:%...
    > Creating dynamically:
    > http://www.dotnetbips.com/displayarticle.aspx?id=66
    >
    > More dg articles @ www.datagridgirl.com/articles.aspx
    >
    > Perhaps you meant creating on the fly? I don't see any benefits rendering

    it
    > on-the-flya s it is rendered if dg just is part of Controls collection on
    > the Page.
    >
    > --
    > Teemu Keiski
    > MCP,Designer/Developer
    > Mansoft tietotekniikka Oy
    > http://www.mansoft.fi
    >
    > AspInsiders Member, www.aspinsiders.com
    > ASP.NET Forums Moderator, www.asp.net
    > AspAlliance Columnist, www.aspalliance.com
    >
    >
    > "chak" <> kirjoitti viestissä
    > news:...
    > > Hi,
    > >
    > > Any examples / pointers on how to render a datagrid on the fly in a

    > asp.net
    > > page, based on dynamic parameters ?
    > >
    > > Thanks.
    > >
    > >

    >
    >
    Dave, Aug 30, 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. Rick Spiewak

    Re: Create thumbnails on the fly

    Rick Spiewak, Jul 24, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    485
    David W. Simmonds
    Jul 25, 2003
  2. Cowboy \(Gregory A. Beamer\)

    Re: programatically create controls on the fly

    Cowboy \(Gregory A. Beamer\), Jul 31, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    430
    Cowboy \(Gregory A. Beamer\)
    Jul 31, 2003
  3. James  Norton-Jones
    Replies:
    4
    Views:
    4,287
    James Zhuo
    Aug 25, 2003
  4. kapil edynamic

    create runtime(on fly ) database ?

    kapil edynamic, Aug 23, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    402
    Steve C. Orr, MCSD
    Aug 23, 2003
  5. Brian

    Fly outmenu on the fly

    Brian, Apr 8, 2005, in forum: Javascript
    Replies:
    0
    Views:
    101
    Brian
    Apr 8, 2005
Loading...

Share This Page