Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: Hyperlink in DataReader


Message #1 by "Rich Lipscomb" <rlipscomb@h...> on Tue, 21 May 2002 20:21:46
I am using a datareader to render data from an Access database.  The 
following code works fine, but does not display the "link item" as a link, 
i.e., it is not underlined and nothing happens if clicked.  What can I do 
to get the "link" to work as a hyperlink?  Thanks.

  <ASP:DataList id="MyRepeater2" RepeatColumns="1" 
RepeatDirection="Horizontal" runat="server">
      <ItemTemplate>
        <%# DataBinder.Eval(Container.DataItem, "Link") %>
          <%# DataBinder.Eval(Container.DataItem, "LinkDesc") %><p></p>
      </ItemTemplate>
  </ASP:DataList>
Message #2 by "Sri Vidya" <svsvidya@i...> on Wed, 22 May 2002 14:54:41 +0530
Hi,

   The code below provides similar effect you are trying to produce. 
Hope this helps.


<script runat="server">

Sub MyRepeater2_ItemCommand(s as Object, e as 
DataListCommandEventArgs)

    Your code goes in here...

end sub

</script>

<form runat="server">

<ASP:DataList id="MyRepeater2" RepeatColumns="1" 
     RepeatDirection="Horizontal" 
     OnItemCommand="MyRepeater2_ItemCommand" 
     Runat="server">

<ItemTemplate>
      <asp:LinkButton Text='<%# Container.DataItem("Link")%>' 
Runat="Server" />
</ItemTemplate>

<SelectedItemTemplate>
<%# Container.DataItem("Link Message") %>
</SelectedItemTemplate>

</as:DataList>

</form>

Cheers,
Vidiya.


On Tue, 21 May 2002 20:21:46
  "Rich Lipscomb" <rlipscomb@h...> wrote:
>I am using a datareader to render data from an Access database.  The 
>following code works fine, but does not display the "link item" as a 
>link, 
>i.e., it is not underlined and nothing happens if clicked.  What can 
>I do 
>to get the "link" to work as a hyperlink?  Thanks.
>
>   <ASP:DataList id="MyRepeater2" RepeatColumns="1" 
>RepeatDirection="Horizontal" runat="server">
>       <ItemTemplate>
>         <%# DataBinder.Eval(Container.DataItem, "Link") %>
>           <%# DataBinder.Eval(Container.DataItem, "LinkDesc") 
>%><p></p>
>       </ItemTemplate>
>   </ASP:DataList>

---------------------------------------------
http://mail.indiainfo.com
India's first ISO certified portal
Check world time at http://time.indiainfo.com
Message #3 by "Rich Lipscomb" <rlipscomb@h...> on Thu, 23 May 2002 19:20:14
Thank you very much!

> Hi,

   The code below provides similar effect you are trying to produce. 
Hope this helps.


<script runat="server">

Sub MyRepeater2_ItemCommand(s as Object, e as 
DataListCommandEventArgs)

    Your code goes in here...

end sub

</script>

<form runat="server">

<ASP:DataList id="MyRepeater2" RepeatColumns="1" 
     RepeatDirection="Horizontal" 
     OnItemCommand="MyRepeater2_ItemCommand" 
     Runat="server">

<ItemTemplate>
      <asp:LinkButton Text='<%# Container.DataItem("Link")%>' 
Runat="Server" />
</ItemTemplate>

<SelectedItemTemplate>
<%# Container.DataItem("Link Message") %>
</SelectedItemTemplate>

</as:DataList>

</form>

Cheers,
Vidiya.


On Tue, 21 May 2002 20:21:46
  "Rich Lipscomb" <rlipscomb@h...> wrote:
>I am using a datareader to render data from an Access database.  The 
>following code works fine, but does not display the "link item" as a 
>link, 
>i.e., it is not underlined and nothing happens if clicked.  What can 
>I do 
>to get the "link" to work as a hyperlink?  Thanks.
>
>   <ASP:DataList id="MyRepeater2" RepeatColumns="1" 
>RepeatDirection="Horizontal" runat="server">
>       <ItemTemplate>
>         <%# DataBinder.Eval(Container.DataItem, "Link") %>
>           <%# DataBinder.Eval(Container.DataItem, "LinkDesc") 
>%><p></p>
>       </ItemTemplate>
>   </ASP:DataList>

---------------------------------------------
http://mail.indiainfo.com
India's first ISO certified portal
Check world time at http://time.indiainfo.com

  Return to Index