Im trying to create dynamic hyperlinks but it doesnt work properly. Ive searched the net but cant find anything similar to what Im trying to do...
The code should print a hyperlink per company that the user has permission to, ie if user has permission to three companies there should be three hyperlinks, one for each company. I only get 1 no mather how many I have permissions to! It seems it cant handle more than one link?
First I tried to create the hyperlink in the code behind
aspx page
code behind page
And since that didnt work I tried this
aspx page
code behind page
Needless to say that neither of them works, otherwise I wouldnt be turning to you guys :-\
How do I go about to get a link for every "vRow" in the datatable?!?
The code should print a hyperlink per company that the user has permission to, ie if user has permission to three companies there should be three hyperlinks, one for each company. I only get 1 no mather how many I have permissions to! It seems it cant handle more than one link?
First I tried to create the hyperlink in the code behind
aspx page
Code:
<asp:Label ID="lblCompany" runat="server"></asp:Label>
code behind page
Code:
Dim vDataTable As DataTable = Permissions.GetPermission(UserId)
Dim vRow As DataRow
If vDataTable.Rows.Count > 0 Then
Dim s As String = ""
For Each vRow In vDataTable.Rows
s = s & "<br><asp:hyperlink NavigateUrl=Page.aspx?company= & vRow.Item(2) Text=" & vRow.Item(2) & " runat=server></asp:HyperLink>"
Next
lblCompany.Text = s
End If
And since that didnt work I tried this
aspx page
Code:
<asp:HyperLink ID="lnkCompany" runat="server"></asp:HyperLink>
code behind page
Code:
Dim vDataTable As DataTable = Permissions.GetPermission(UserId)
Dim vRow As DataRow
If vDataTable.Rows.Count > 0 Then
For Each vRow In vDataTable.Rows
lnkCompany.Text = vRow.Item(2)
lnkCompany.NavigateUrl = "Page.aspx?company=" & vRow.Item(2)
Next
End If
Needless to say that neither of them works, otherwise I wouldnt be turning to you guys :-\
How do I go about to get a link for every "vRow" in the datatable?!?