I have build my gridview and it shows fine but now I need a custom link that enables
the user to view the file. For that I need to build the link dynamically using
the other gridview column content in the link path.
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Member
8 Points
34 Posts
gridview, build hyperlinkfield dynamically
Mar 28, 2019 07:18 AM|metallonorg|LINK
Dear .net Experts,
I have build my gridview and it shows fine but now I need a custom link that enables
the user to view the file. For that I need to build the link dynamically using
the other gridview column content in the link path.
datanavigateurlformatstring="http://....com/Members/files/{id}+/+{filename}" />
How can I do this?
Participant
1101 Points
673 Posts
Re: gridview, build hyperlinkfield dynamically
Mar 28, 2019 02:41 PM|jzero|LINK
Replace your HyperLinkField by this one
Contributor
2150 Points
705 Posts
Re: gridview, build hyperlinkfield dynamically
Mar 29, 2019 03:28 AM|Jenifer Jiang|LINK
Hi metallonorg,
According to your description and code, I suggest that you could write the string including the format {0}.
You could refer to: https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.webcontrols.hyperlinkfield.datanavigateurlformatstring?view=netframework-4.7.2
Note:
The format string is applied only when the DataNavigateUrlFields property is set.
The format string can be any literal string and usually includes a placeholder for the field's value.
Best Regards,
Jenifer
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.