asp:HyperLink array ?!

T

Thubaiti

Hi,

I have this code:

Code:
<td>
<a href="#" class="toolbar">Computers</a>
<a href="commun.html" class="toolbar">Communications</a>
<a href="electronics.html" class="toolbar">Electronics</a>
<a href="#" class="toolbar">Others</a>
</td>

After that, I want to get the information from the database, so I changed my
code to:

Code:
<td>
<asp:HyperLink CssClass="toolbar" id="HyperLink"
runat="server"></asp:HyperLink>
</td>

and this is my code behind:

Code:
// sqlConnection
String connectionString = "server=ICSFREEDOM; TRUSTED_CONNECTION=true;
database=Offers";
// command string
String commandString = "SELECT name FROM swe_category";
// data adapter
sqlDataAdapter = new SqlDataAdapter(commandString, connectionString);
// data set
DataSet dataSet = new DataSet();
// fill
sqlDataAdapter.Fill(dataSet, "swe_category");
// data table
DataTable dataTable = dataSet.Tables[0];

foreach(DataRow dataRow in dataTable.Rows) {
HyperLink.Text = dataRow["name"].ToString();
HyperLink.NavigateUrl = dataRow["name"].ToString() + ".aspx";
}

Now, the problem is: I do not know how can I create an array of
asp:HyperLink

Any help please ?!

thanks...
 
B

Bob Barrows [MVP]

There was no way for you to know it, but this is a classic asp newsgroup.
While you may be lucky enough to find a dotnet-savvy person here who can
answer your question, you can eliminate the luck factor by posting your
question to a newsgroup where the dotnet-savvy people hang out. I suggest
microsoft.public.dotnet.framework.aspnet.

HTH,
Bob Barrows
 
R

Ray Costanzo [MVP]

Hi Thubaiti,

This is a classic ASP group. ASP.NET questions are handled in groups with
"aspnet" in their names, such as microsoft.public.dotnet.framework.aspnet.

Ray at work
 
E

Egbert Nierop \(MVP for IIS\)

Thubaiti said:

Indeed, an asp.net question.
But basically, you should use a -datarepeater- control, where you can bind
your data to the template that you define yourself.
 
T

Thubaiti

Egbert Nierop (MVP for IIS) said:
Indeed, an asp.net question.
But basically, you should use a -datarepeater- control, where you can bind
your data to the template that you define yourself.

Yes, I used Repeater control to do that..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,198
Latest member
JaimieWan8

Latest Threads

Top