|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
.NET 2 Custom Control questionlist 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> 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). 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> > >
How to Address Other Controls' IDs?
Custom dropdownlist that displays a listbox Using DataList - table and headers DataItem in DataListItem is null. How to build dynamicaly a menu in ASP.Net 2.0 (VS 2005) ? Output the HTML contents of a dynamically created control Picture on a button DHTML MENU problem in IE Anybody using Table control? How Do I Use a CheckBox to Update a Bit Type Data Field in a DataGrid |
|||||||||||||||||||||||