Home > Archive > ASP > December 2004 > asp:HyperLink array ?!
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
asp:HyperLink array ?!
|
|
| Thubaiti 2004-12-17, 3:55 pm |
| 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...
| |
| Bob Barrows [MVP] 2004-12-17, 3:55 pm |
| 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
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
| |
| Ray Costanzo [MVP] 2004-12-17, 3:55 pm |
| 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
"Thubaiti" <Thubaiti@discussions.microsoft.com> wrote in message
news:8396F7D9-1971-43AB-861F-BD0E86805459@microsoft.com...
> Hi,
>
> I have this code:
> <asp:HyperLink CssClass="toolbar" id="HyperLink"
> runat="server"></asp:HyperLink>
| |
| Egbert Nierop \(MVP for IIS\) 2004-12-18, 12:46 pm |
| "Thubaiti" <Thubaiti@discussions.microsoft.com> wrote in message
news:8396F7D9-1971-43AB-861F-BD0E86805459@microsoft.com...
> Hi,
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.
| |
| Thubaiti 2004-12-18, 12:46 pm |
|
"Egbert Nierop (MVP for IIS)" wrote:
> "Thubaiti" <Thubaiti@discussions.microsoft.com> wrote in message
> news:8396F7D9-1971-43AB-861F-BD0E86805459@microsoft.com...
>
> 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..
|
|
|
|
|