Gridview set DataNavigateUrlFields

JackInDaBox

New member
Joined
Jun 15, 2007
Messages
1
Programming Experience
Beginner
Hello,
I have a Gridview (VS 2005 VB .Net ASP 2.0) that presently works and displays the right information. I want to change it so that the DataNavigateUrlFields is not hard coded. Currently the html looks like this:

<asp:GridView ID="DispositionGridView" runat="server" AutoGenerateColumns="False" BackColor="White"
Font-Names="Verdana" Font-Size="XX-Small" Style="z-index: 100; left: 0px; position: absolute;
top: 16px" Width="236px">
<Columns>
<asp:HyperLinkField DataNavigateUrlFields="path"
DataTextField="disposition_file_name" HeaderText="View Disposition File" Target="_blank" />
<asp:BoundField DataField="disposition_revision" HeaderText="Revision No." />
<asp:HyperLinkField DataNavigateUrlFields="job_no" DataTextField="job_no" HeaderText="Job No."
Target="_blank" DataNavigateUrlFormatString="http://www.TestThis.ca/test/jobform/jobform.aspx?JobNo={0}" />
</Columns>
<HeaderStyle BackColor="#4B4C5C" Font-Names="Verdana" Font-Size="XX-Small" ForeColor="White" />
<AlternatingRowStyle BackColor="#E0E0E0" Font-Names="Verdana" Font-Size="XX-Small" />
</asp:GridView>

My question is can I change the DataNavigateUrlFormatString to equal a variable? The variable would be equal to the URL link that I would have to get from the database. I want to do this so that if we change the server name I only need to make the change in the database. Something like:

Dim var as string
Var = GetLinkFromDB() ‘GetLinkFromDB() = ://www.TestThis.ca/
Var = Var + “test/jobform/jobform.aspx”

Thanks for the help
 
Back
Top