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.
> >
> >
>
>