Avatar of JoshinHtown
JoshinHtown
Flag for United States of America asked on

Create Hyperlink in DetailsView..

Hello-

I have a DetailsView that gets binded to a datatable.  One of the Columns has a Website URL called "Website".  Another Column has a ID field that needs to get binded to the Website URL address and that field is called "HCAD_NUM".  I need a hyperlink to appear at runtime that the user can click on and the Webpage will popup.  Below is the only code I have at this point.

Thanks,
<asp:Panel ID="Panel1" runat="server" Height="552px" Width="296px" ScrollBars="Auto">
            <asp:DetailsView ID="DetailsView1" runat="server" BackColor="#CCCCCC" BorderColor="#999999"
                BorderStyle="Solid" BorderWidth="3px" CellPadding="4" CellSpacing="2" ForeColor="Black"
                Height="50px" Width="125px">
 
                <FooterStyle BackColor="#CCCCCC" />
                <RowStyle BackColor="White" />
                <PagerStyle BackColor="#CCCCCC" ForeColor="Black" HorizontalAlign="Left" />
                <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
                <EditRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
 
            </asp:DetailsView>
        </asp:Panel>

Open in new window

ASP.NETVisual Basic.NET

Avatar of undefined
Last Comment
JoshinHtown

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
jmwheeler

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
JoshinHtown

ASKER
Yes almost perfect.  After they click the hyperlink, can it open the webpage in a new window and not the same window that the detailsview is displayed in?
JoshinHtown

ASKER
Also, one last thing.  You will notice in the screenshot below the hyperlink is showing the full URL of website.  Can it just display the words "Website Link" and have the hyperlink work off of that?  Also, any chance this link can show up at top of DetailsView?

That would be all I need.  Thank you so much if you can get this working.

Best regards,
Display-of-detailsView.gif
jmwheeler

The adjustment below will change the diplay text and open it in a new window:

<a href='<%# Eval("Website") %>?ID=<%# Eval("HCAD_NUM") % target="_blank">'Website Link</a>

If you want to re-order the field you would need to set "AutoGenerateRows" to false on your details view and then specify the fields you want in the fields tag I used in my example above.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
JoshinHtown

ASKER
Hi jmwheeler-

I apologize for getting a tad impatient but I posted another Question at the below link related to this matter.  I gave you points for this thread but I felt the other questions which you have recently answered should be a seperate question.  Please post a thread at the below link to get the points there as well.  Thanks jmwheeler

https://www.experts-exchange.com/questions/24190566/Customize-Display-of-DetailsView.html