Home All Groups Group Topic Archive Search About

Dynamic generation of a table

Author
2 Jul 2009 6:02 PM
K Viltersten
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.

Author
2 Jul 2009 6:08 PM
Alexey Smirnov
Show quote Hide quote
On Jul 2, 8:02 pm, "K Viltersten" <t***@viltersten.com> 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?
Are all your drivers up to date? click for free checkup

Author
2 Jul 2009 10:17 PM
K Viltersten
>> 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.
Author
3 Jul 2009 7:30 AM
Alexey Smirnov
Show quote Hide quote
On Jul 3, 12:17 am, "K Viltersten" <t***@viltersten.com> 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
Author
3 Jul 2009 9:51 AM
K Viltersten
> 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.
Author
3 Jul 2009 11:35 AM
Alexey Smirnov
Show quote Hide quote
On Jul 3, 11:51 am, "K Viltersten" <t***@viltersten.com> 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>
Author
4 Jul 2009 7:11 AM
K Viltersten
>> 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.

Bookmark and Share