Dynamic generation of a table

Discussion in 'ASP .Net' started by K Viltersten, Jul 2, 2009.

  1. K Viltersten

    K Viltersten Guest

    In my asp:Repeater, i'm starting a mark-up
    for a table in the <HeaderTemplate> and
    finish it up in the <FooterTemplate>.
    However, i'd like to dynamically create it
    and i wonder how i can do so.

    How can i produce "a half" of HtmlTable?
    Or should i rather aim for dynamically
    creating the whole asp:Repeater part? How
    can i do that wisely (i.e. smoothly)?

    --
    Regards
    K Viltersten
    ----------------------------------------
    May all spammers die an agonizing death;
    have no burial places; their souls be
    chased by demons in Gehenna from one room
    to another for all eternity and beyond.
     
    K Viltersten, Jul 2, 2009
    #1
    1. Advertising

  2. On Jul 2, 8:02 pm, "K Viltersten" <> wrote:
    > In my asp:Repeater, i'm starting a mark-up
    > for a table in the <HeaderTemplate> and
    > finish it up in the <FooterTemplate>.
    > However, i'd like to dynamically create it
    > and i wonder how i can do so.
    >
    > How can i produce "a half" of HtmlTable?
    > Or should i rather aim for dynamically
    > creating the whole asp:Repeater part? How
    > can i do that wisely (i.e. smoothly)?
    >
    > --
    > Regards
    > K Viltersten
    > ----------------------------------------
    > May all spammers die an agonizing death;
    > have no burial places; their souls be
    > chased by demons in Gehenna from one room
    > to another for all eternity and beyond.


    Why don't you use <asp:table> then? Or a gridview?
     
    Alexey Smirnov, Jul 2, 2009
    #2
    1. Advertising

  3. K Viltersten

    K Viltersten Guest

    SV: Dynamic generation of a table

    >> In my asp:Repeater, i'm starting a mark-up
    >> for a table in the <HeaderTemplate> and
    >> finish it up in the <FooterTemplate>.
    >> However, i'd like to dynamically create it
    >> and i wonder how i can do so.
    >>
    >> How can i produce "a half" of HtmlTable?
    >> Or should i rather aim for dynamically
    >> creating the whole asp:Repeater part? How
    >> can i do that wisely (i.e. smoothly)?

    >
    > Why don't you use <asp:table> then? Or a
    > gridview?


    I'm not sure how that helps. Please elaborate.

    --

    Regards
    Konrad Viltersten
    --------------------------------
    May all spammers die an agonizing death;
    have no burial places; their souls be
    chased by demons in Gehenna from one room
    to another for all eternity and beyond.
     
    K Viltersten, Jul 2, 2009
    #3
  4. On Jul 3, 12:17 am, "K Viltersten" <> wrote:
    > >> In my asp:Repeater, i'm starting a mark-up
    > >> for a table in the <HeaderTemplate> and
    > >> finish it up in the <FooterTemplate>.
    > >> However, i'd like to dynamically create it
    > >> and i wonder how i can do so.

    >
    > >> How can i produce "a half" of HtmlTable?
    > >> Or should i rather aim for dynamically
    > >> creating the whole asp:Repeater part? How
    > >> can i do that wisely (i.e. smoothly)?

    >
    > > Why don't you use <asp:table> then? Or a
    > > gridview?

    >
    > I'm not sure how that helps. Please elaborate.
    >
    > --
    >
    > Regards
    > Konrad Viltersten
    > --------------------------------
    > May all spammers die an agonizing death;
    > have no burial places; their souls be
    > chased by demons in Gehenna from one room
    > to another for all eternity and beyond.


    Hi Konrad,

    ASP.NET has few other controls to generate tables - GridView and Table

    http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.table.aspx
    http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.aspx

    So, instead of modifying a list from Repeater, you can build a table
    using GridView, or Table controls.

    If for any reason you need to have a Repeater, do following:

    <%@ Import Namespace="System.Data" %>

    <asp:Repeater id="cdcatalog" runat="server">

    <HeaderTemplate>
    <table border="1" width="100%">
    <tr>
    <th>Title</th>
    <th>Artist</th>
    <th>Company</th>
    <th>Price</th>
    </tr>
    </HeaderTemplate>

    <ItemTemplate>
    <tr>
    <td><%#Container.DataItem("title")%> </td>
    <td><%#Container.DataItem("artist")%> </td>
    <td><%#Container.DataItem("company")%> </td>
    <td><%#Container.DataItem("price")%> </td>
    </tr>
    </ItemTemplate>

    <FooterTemplate>
    </table>
    </FooterTemplate>

    </asp:Repeater>

    Hope this helps
     
    Alexey Smirnov, Jul 3, 2009
    #4
  5. K Viltersten

    K Viltersten Guest

    > ASP.NET has few other controls to generate
    > tables - GridView and Table
    > http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.table.aspx
    > http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.aspx
    > So, instead of modifying a list from
    > Repeater, you can build a table using
    > GridView, or Table controls.
    > If for any reason you need to have a Repeater,
    > do following:
    > <%@ Import Namespace="System.Data" %>
    > <asp:Repeater id="cdcatalog" runat="server">
    > <HeaderTemplate>
    > <table border="1" width="100%">
    > <tr>

    <snip>

    I'd need to change the style of the table
    dynamically, from code behind. In order to
    do so, i need to run it on server BUT then
    i get problems because when run on server,
    the control/element (table) musn't span
    accross multiple templates... Sight... :(

    Suggestions?
    (Yes, i'm required to use asp:Repeater.)

    --
    Regards
    K Viltersten
    ----------------------------------------
    May all spammers die an agonizing death;
    have no burial places; their souls be
    chased by demons in Gehenna from one room
    to another for all eternity and beyond.
     
    K Viltersten, Jul 3, 2009
    #5
  6. On Jul 3, 11:51 am, "K Viltersten" <> wrote:
    > > ASP.NET has few other controls to generate
    > > tables - GridView and Table
    > >http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.tab...
    > >http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gri...
    > > So, instead of modifying a list from
    > > Repeater, you can build a table using
    > > GridView, or Table controls.
    > > If for any reason you need to have a Repeater,
    > > do following:
    > > <%@ Import Namespace="System.Data" %>
    > > <asp:Repeater id="cdcatalog" runat="server">
    > > <HeaderTemplate>
    > > <table border="1" width="100%">
    > > <tr>

    >
    > <snip>
    >
    > I'd need to change the style of the table
    > dynamically, from code behind. In order to
    > do so, i need to run it on server BUT then
    > i get problems because when run on server,
    > the control/element (table) musn't span
    > accross multiple templates... Sight... :(
    >
    > Suggestions?
    > (Yes, i'm required to use asp:Repeater.)
    >
    > --
    > Regards
    > K Viltersten
    > ----------------------------------------
    > May all spammers die an agonizing death;
    > have no burial places; their souls be
    > chased by demons in Gehenna from one room
    > to another for all eternity and beyond.


    <HeaderTemplate>
    <table style="<%=TableStyle%>">
    </HeaderTemplate>
     
    Alexey Smirnov, Jul 3, 2009
    #6
  7. K Viltersten

    K Viltersten Guest

    SV: Dynamic generation of a table

    >> Suggestions?
    >> (Yes, i'm required to use asp:Repeater.)

    >
    > <HeaderTemplate>
    > <table style="<%=TableStyle%>">
    > </HeaderTemplate>



    Got it. Thanks.

    --

    Regards
    Konrad Viltersten
    --------------------------------
    May all spammers die an agonizing death;
    have no burial places; their souls be
    chased by demons in Gehenna from one room
    to another for all eternity and beyond.
     
    K Viltersten, Jul 4, 2009
    #7
    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 Glos
    Replies:
    0
    Views:
    647
    Rick Glos
    Jul 8, 2003
  2. Al Wilkerson
    Replies:
    1
    Views:
    2,753
    =?Utf-8?B?U2FyYXZhbmFuIEsgVg==?=
    Mar 14, 2005
  3. =?Utf-8?B?QkxpVFpXaU5H?=

    Adding dynamic LinkButton to dynamic table

    =?Utf-8?B?QkxpVFpXaU5H?=, Jul 27, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    731
    =?Utf-8?B?QkxpVFpXaU5H?=
    Jul 27, 2005
  4. opius
    Replies:
    0
    Views:
    1,182
    opius
    Jun 17, 2011
  5. John W. Long

    HTML Generation (Next Generation CGI)

    John W. Long, Nov 22, 2003, in forum: Ruby
    Replies:
    4
    Views:
    344
    John W. Long
    Nov 24, 2003
Loading...

Share This Page