Link to home
Create AccountLog in
Avatar of CollegeofPublicHealthIT
CollegeofPublicHealthIT

asked on

Adding colum info to URL String

I have an aspx page built to try and view info from a datagrid view. I want to have the Url in the Image Link colum be a link to the imageid specified in the imageid colum of my SQL table. I cannot figure out how to get the ~/Images to prepend the imageid field. The link when in the document just goes to /imagename.png and not to the ~/Images/imagename.png. Can anyone assist with this? Thank you.


<asp:HyperLinkField 
                DataTextFormatString="click here" HeaderText="Image Link" 
                NavigateUrl="~/Images/" Text="click here" Target=_blank 
                DataNavigateUrlFields="lmageid" />

Open in new window

Avatar of Nilang_ETI
Nilang_ETI
Flag of United States of America image

Following should work

<asp:HyperLinkField
                DataTextFormatString="click here" HeaderText="Image Link"
                NavigateUrl="~/Images/{0}" Text="click here" Target=_blank
                DataNavigateUrlFields="lmageid" />

for more help refer following link
http://authors.aspalliance.com/aspxtreme/sys/web/ui/webcontrols/HyperLinkFieldClassDataNavigateUrlFields.aspx

Hope this helps. Happy programming !!!
and if Imageid field already contain / then try following

<asp:HyperLinkField
                DataTextFormatString="click here" HeaderText="Image Link"
                NavigateUrl="~/Images{0}" Text="click here" Target=_blank
                DataNavigateUrlFields="lmageid" />

ASKER CERTIFIED SOLUTION
Avatar of Nilang_ETI
Nilang_ETI
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of CollegeofPublicHealthIT
CollegeofPublicHealthIT

ASKER

Thanks, That solved my problem, couldn't get the formatting right on it before but that did it.