Nate Pet
Nate Pet

Reputation: 46222

asp.net - change column to hyperlink column

I have the following column:

    <asp:BoundField DataField="ProID" HeaderStyle-BackColor="#0066cc"  
    HeaderStyle-Font-Size="7pt" HeaderStyle-HorizontalAlign="center"  
    HeaderText="ProID" ItemStyle-HorizontalAlign="center" /> 

How do I make this into a hyperlink column?

I tried the following:

    <asp:HyperLinkColumn DataNavigateUrlField="ProID"  
    DataNavigateUrlFormatString="pro.aspx?pro={0}"  
    DataTextField="ProID" HeaderText="ProID" SortExpression="ProID"> 
    <HeaderStyle HorizontalAlign="Left" /> 
    <ItemStyle HorizontalAlign="Left" /> 
    </asp:HyperLinkColumn> 

Not sure why it is giving me this message. My goal is simply to make that column into a hyplink so that I can have the user to to the designated page.

but getting HyperLinkColumn' is not a known element. This can occur if there is a compilation error in the Web site

Upvotes: 0

Views: 423

Answers (1)

Shyju
Shyju

Reputation: 218782

Use HyperLinkField

<asp:HyperLinkField DataTextField="ProID" DataNavigateUrlFields="ProID" 
        DataNavigateUrlFormatString="pro.aspx?pro={0}" Text="ProID" />

Upvotes: 2

Related Questions