Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > How to create a datagrid on the fly ?

Reply
Thread Tools

How to create a datagrid on the fly ?

 
 
chak
Guest
Posts: n/a
 
      08-27-2003
Hi,

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

Thanks.


 
Reply With Quote
 
 
 
 
Teemu Keiski
Guest
Posts: n/a
 
      08-28-2003
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.
>
>



 
Reply With Quote
 
 
 
 
Dave
Guest
Posts: n/a
 
      08-30-2003
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.
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
“test what you fly and fly what you test†Lawrence D'Oliveiro NZ Computing 0 06-05-2009 02:06 AM
THE FLY & THE FLY II teem DVD Video 0 12-10-2005 09:31 PM
To Fly or not to fly? Should I move from Mozilla 1.5 to T-bird andF-bird? Daniel Steinberg Firefox 7 11-06-2003 11:31 AM
To Fly or not to fly? Should I move from Mozilla 1.5 to T-bird andF-bird? Daniel Steinberg Firefox 5 11-05-2003 06:23 AM



Advertisments