Home All Groups Group Topic Archive Search About
Author
21 Nov 2005 5:49 PM
ME
I am trying to write my first site using .NET 2.  I need a control that will
list several links to pages in a table (a simple nav control).  The table
must have about 3 Columns and about 4 rows (or more depending on the amount
of links needed).  The table will need to be built dynamically, but it
should display the links in only 1 row or only 1 column.  In each cell a
hyperlink will be added (dynamically) that will link a a specific page.  The
URL's for the hyperlinks will be read from a Database (used to be able to
use a DataReader, not sure if thats the best way now).  In previous .NET 1.1
I could just open a datareader, cycle through and generate the table in the
pre-render event of the custom control.  What would be the BEST way of
creating this type of control in .NET 2?

Thanks,

Matt


Table Example:

<table>

<tr>

<td>

<asp:HyperLink ID="HyperLink1" runat="server">HyperLink</asp:HyperLink></td>

<td>

<asp:HyperLink ID="HyperLink3" runat="server">HyperLink</asp:HyperLink></td>

<td>

<asp:HyperLink ID="HyperLink2" runat="server">HyperLink</asp:HyperLink></td>

</tr>

<tr>

<td >

<asp:HyperLink ID="HyperLink4" runat="server">HyperLink</asp:HyperLink></td>

<td>

<asp:HyperLink ID="HyperLink5" runat="server">HyperLink</asp:HyperLink></td>

<td>

<asp:HyperLink ID="HyperLink6" runat="server">HyperLink</asp:HyperLink></td>

</tr>

<tr>

<td>

<asp:HyperLink ID="HyperLink7" runat="server">HyperLink</asp:HyperLink></td>

<td>

<asp:HyperLink ID="HyperLink8" runat="server">HyperLink</asp:HyperLink></td>

<td>

<asp:HyperLink ID="HyperLink9" runat="server">HyperLink</asp:HyperLink></td>

</tr>

<tr>

<td>

<asp:HyperLink ID="HyperLink10"
runat="server">HyperLink</asp:HyperLink></td>

<td>

<asp:HyperLink ID="HyperLink11"
runat="server">HyperLink</asp:HyperLink></td>

<td>

<asp:HyperLink ID="HyperLink12"
runat="server">HyperLink</asp:HyperLink></td>

</tr>

</table>

Author
21 Nov 2005 8:16 PM
Steve C. Orr [MVP, MCSD]
I can't think of any way that ASP.NET 2.0 makes this kind of custom
requirement much easier.
You could still use your old approach, or you could still use a Repeater, or
you could still use a Table control (that would probably be my preference).

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net


Show quoteHide quote
"ME" <trash.trash@comcast.netREMOVETHIS> wrote in message
news:AIqdnevQdeMnlR_enZ2dnUVZ_vidnZ2d@comcast.com...
>I am trying to write my first site using .NET 2.  I need a control that
>will list several links to pages in a table (a simple nav control).  The
>table must have about 3 Columns and about 4 rows (or more depending on the
>amount of links needed).  The table will need to be built dynamically, but
>it should display the links in only 1 row or only 1 column.  In each cell a
>hyperlink will be added (dynamically) that will link a a specific page.
>The URL's for the hyperlinks will be read from a Database (used to be able
>to use a DataReader, not sure if thats the best way now).  In previous .NET
>1.1 I could just open a datareader, cycle through and generate the table in
>the pre-render event of the custom control.  What would be the BEST way of
>creating this type of control in .NET 2?
>
> Thanks,
>
> Matt
>
>
> Table Example:
>
> <table>
>
> <tr>
>
> <td>
>
> <asp:HyperLink ID="HyperLink1"
> runat="server">HyperLink</asp:HyperLink></td>
>
> <td>
>
> <asp:HyperLink ID="HyperLink3"
> runat="server">HyperLink</asp:HyperLink></td>
>
> <td>
>
> <asp:HyperLink ID="HyperLink2"
> runat="server">HyperLink</asp:HyperLink></td>
>
> </tr>
>
> <tr>
>
> <td >
>
> <asp:HyperLink ID="HyperLink4"
> runat="server">HyperLink</asp:HyperLink></td>
>
> <td>
>
> <asp:HyperLink ID="HyperLink5"
> runat="server">HyperLink</asp:HyperLink></td>
>
> <td>
>
> <asp:HyperLink ID="HyperLink6"
> runat="server">HyperLink</asp:HyperLink></td>
>
> </tr>
>
> <tr>
>
> <td>
>
> <asp:HyperLink ID="HyperLink7"
> runat="server">HyperLink</asp:HyperLink></td>
>
> <td>
>
> <asp:HyperLink ID="HyperLink8"
> runat="server">HyperLink</asp:HyperLink></td>
>
> <td>
>
> <asp:HyperLink ID="HyperLink9"
> runat="server">HyperLink</asp:HyperLink></td>
>
> </tr>
>
> <tr>
>
> <td>
>
> <asp:HyperLink ID="HyperLink10"
> runat="server">HyperLink</asp:HyperLink></td>
>
> <td>
>
> <asp:HyperLink ID="HyperLink11"
> runat="server">HyperLink</asp:HyperLink></td>
>
> <td>
>
> <asp:HyperLink ID="HyperLink12"
> runat="server">HyperLink</asp:HyperLink></td>
>
> </tr>
>
> </table>
>
>