Sign In  |  Register
 
 DotNetNuke Powered!
DotNetNuke Support Forums

DataGrid Question

Rate this topic:

Please Register to post a reply.
Another benefit of registration is the ability to subscribe to and recieve notifications of new posts.

AuthorMessages
jncraig
Posts:79



07/27/2007 1:57 PM  

I hope that this isn't too off of the mark ...

I'm trying to use a DataGrid control to build a list of hyperlinks.  I build the hyperlinks with an SQL query to a table, and I get this as a result:

oops ... when I paste this in ... the table gets converted to links ...

The table has rows of the form:  [bracket]a href="/community/allforums /tabid/54/view/topics/forumid/253/Default.aspx"[bracket] BAC [bracket]/a[bracket]

The datagrid shows the text including the opening and closing brackets.


What I want to have happen is for the text in the datagrid to be rendered as hyperlinks.  Is there a way to do this?

John Mitchell
Posts:3276



07/27/2007 2:31 PM  

 

Hi Joe,

I'm not sure I understand the question, but you may want to use a repeater instead of a DataGrid. 

Here is one example of using a repeater for a list of links:

http://www.aspcode.net/ASPNET-repeater-control-databind-with-style.aspx

John Mitchell
Posts:3276



07/27/2007 2:35 PM  

Looking closer, that example doesn't show exactly how to get the link in the list. 

What you need to do is just like the Text part though, use a DataBind syntax to include a Url from your DataSource:

asp:HyperLink id="hlEdit" runat="server" NavigateUrl="<%# DataBinder.Eval(Container.DataItem, "SiteLink") %>" Text='<%# DataBinder.Eval(Container.DataItem, "SiteName") %>'

jncraig
Posts:79



07/27/2007 6:29 PM  
Thanks. That's close enough to what I was trying to do that I can work with it.
Please Register to post a reply.
Another benefit of registration is the ability to subscribe to and recieve notifications of new posts.




ActiveForums 3.7
Visit our Store for great DotNetNuke Modules and Skins
DNNMasters Sitemap/Google Sitemap 3.0

Item codeSM3-01
Price$29.00
Product Information 
DotNetNuke CSS NavMenu 3.3 (Developers)

Item codeCSSNM33DEV
Base Price$149.00
Product Information 
Snapsis PageBlaster 3.3.2 for DotNetNuke - Professional Edition

AuthorJohn Mitchell
Base Price$79.00
Product Information 
XDAkuna (Web 2.0 CSS XHTML Skin)

Item codeXDAkuna
AuthorNina Meiers
Price$49.00
Product Information