I have a datagrid declared, in which I have a hyperlink
<asp:HyperLinkColumn HeaderText="Title" DataNavigateUrlField="txtFileName" DataNavigateUrlFormatString=" DataTextField="txtTitle" Target="_blank">
I can't change this column from a hyperlink column as other code (written by someone else) relies on it being of this type to extract the filename, however at the moment the is hardwired in the code (its a different site where it gets the docs from)
I want to put this site URL in the web.config:
<appSettings>
<add key="strDocDirectoryURL" value=" />
</appSettings>
and insert it in the DataNavigateUrlFormatString during the databind. I'm guess I'd have to use something like
Private Sub dgDocuments_ItemCommand(ByVal source As System.Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dgDocuments.ItemCommand
but am not sure how to use this and how I can get the value and 'append' the url to the '/doc{0}' of the DataNavigateUrlFormatString (or append it to the DataNavigateUrlField which might be better). Is there maybe some simpler wayI'm missing?
The whole datagrid is below
<asp:datagrid id="dgDocuments" runat="server" DataKeyField="ID">
Columns>
<asp:templateColumn HeaderText=" ">
<itemtemplate>
<a href="/Downloading/FileDownload.aspx?file=<%#DataBinder.Eval(Container.DataItem, "txtFileName")%>" target=_self>
<img src="/images/media/<%#DataBinder.Eval(Container.DataItem, "txtImage")%>" width="17" height="20" border="0" alt="*"/></a>
</itemtemplate>
</asp:templateColumn>
<asp:HyperLinkColumn HeaderText="Title" DataNavigateUrlField="txtFileName" DataNavigateUrlFormatString=" DataTextField="txtTitle" Target="_blank">
</asp:HyperLinkColumn>
<asp:BoundColumn DataField="dteDateUploaded" ReadOnly="True" HeaderText="Uploaded" DataFormatString="{0:dd/MM/yy}">
<HeaderStyle Width="80px"></HeaderStyle>
</asp:BoundColumn>
<asp:templateColumn HeaderText=" ">
<itemtemplate>
<a href="UpdateDocumentForm.aspx?ID=<%#DataBinder.Eval(Container.DataItem, "ID")%>">Edit Details</a>
</itemtemplate>
</asp:templateColumn>
<asp:ButtonColumn Text="Delete" CommandName="Delete"></asp:ButtonColumn>
</Columns>
</asp:datagrid>
<asp:HyperLinkColumn HeaderText="Title" DataNavigateUrlField="txtFileName" DataNavigateUrlFormatString=" DataTextField="txtTitle" Target="_blank">
I can't change this column from a hyperlink column as other code (written by someone else) relies on it being of this type to extract the filename, however at the moment the is hardwired in the code (its a different site where it gets the docs from)
I want to put this site URL in the web.config:
<appSettings>
<add key="strDocDirectoryURL" value=" />
</appSettings>
and insert it in the DataNavigateUrlFormatString during the databind. I'm guess I'd have to use something like
Private Sub dgDocuments_ItemCommand(ByVal source As System.Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dgDocuments.ItemCommand
but am not sure how to use this and how I can get the value and 'append' the url to the '/doc{0}' of the DataNavigateUrlFormatString (or append it to the DataNavigateUrlField which might be better). Is there maybe some simpler wayI'm missing?
The whole datagrid is below
<asp:datagrid id="dgDocuments" runat="server" DataKeyField="ID">
Columns>
<asp:templateColumn HeaderText=" ">
<itemtemplate>
<a href="/Downloading/FileDownload.aspx?file=<%#DataBinder.Eval(Container.DataItem, "txtFileName")%>" target=_self>
<img src="/images/media/<%#DataBinder.Eval(Container.DataItem, "txtImage")%>" width="17" height="20" border="0" alt="*"/></a>
</itemtemplate>
</asp:templateColumn>
<asp:HyperLinkColumn HeaderText="Title" DataNavigateUrlField="txtFileName" DataNavigateUrlFormatString=" DataTextField="txtTitle" Target="_blank">
</asp:HyperLinkColumn>
<asp:BoundColumn DataField="dteDateUploaded" ReadOnly="True" HeaderText="Uploaded" DataFormatString="{0:dd/MM/yy}">
<HeaderStyle Width="80px"></HeaderStyle>
</asp:BoundColumn>
<asp:templateColumn HeaderText=" ">
<itemtemplate>
<a href="UpdateDocumentForm.aspx?ID=<%#DataBinder.Eval(Container.DataItem, "ID")%>">Edit Details</a>
</itemtemplate>
</asp:templateColumn>
<asp:ButtonColumn Text="Delete" CommandName="Delete"></asp:ButtonColumn>
</Columns>
</asp:datagrid>