russomr
asked on
Add a hyperlink to a data view control
I have the following:
<asp:GridView ID="gvResults" runat="server" Width="100%" AutoGenerateColumns="false " CellPadding="4" ForeColor="#333333"
GridLines="None">
<Columns>
<asp:BoundField ReadOnly="true" HeaderText="DBA Name" DataField="DBAName" />
<asp:BoundField ReadOnly="true" HeaderText="City" DataField="City" />
<asp:BoundField ReadOnly="true" HeaderText="State" DataField="State" />
<asp:BoundField ReadOnly="true" HeaderText="P&C Volume" DataField="PCVolume" />
<asp:BoundField ReadOnly="true" HeaderText="Life Vol" DataField="LifeVolume" />
<asp:BoundField ReadOnly="true" HeaderText="Field Rep" DataField="PCFieldRep" />
</Columns>
</asp:GridView>
I get a view with all of the fields displaying correctly, but for the DBAName, I actually want to display the DBAName, but have it be a hyperlink that opens a new window with the URL (which is contained in the datasource as 'Website'). If 'Website' is null or empty, it does not show the DBAName as a hyplerlink, but just text.
Can anyone help? This is my first exposure to a dataview.
Thanks.
<asp:GridView ID="gvResults" runat="server" Width="100%" AutoGenerateColumns="false
GridLines="None">
<Columns>
<asp:BoundField ReadOnly="true" HeaderText="DBA Name" DataField="DBAName" />
<asp:BoundField ReadOnly="true" HeaderText="City" DataField="City" />
<asp:BoundField ReadOnly="true" HeaderText="State" DataField="State" />
<asp:BoundField ReadOnly="true" HeaderText="P&C Volume" DataField="PCVolume" />
<asp:BoundField ReadOnly="true" HeaderText="Life Vol" DataField="LifeVolume" />
<asp:BoundField ReadOnly="true" HeaderText="Field Rep" DataField="PCFieldRep" />
</Columns>
</asp:GridView>
I get a view with all of the fields displaying correctly, but for the DBAName, I actually want to display the DBAName, but have it be a hyperlink that opens a new window with the URL (which is contained in the datasource as 'Website'). If 'Website' is null or empty, it does not show the DBAName as a hyplerlink, but just text.
Can anyone help? This is my first exposure to a dataview.
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can do an onDataBinding event and manipulate the data going in if you need to.
ASKER
How do you do that? I've upped the points because I feel I'm asking a lot.
ASKER