fergus

fergus

  • 1.5k
  • 232
  • 1.7k

ASP Gridview not returning my sql data

Apr 11 2024 10:23 AM

hi,

I am trying to return some columns from my ms sql table and assigning url links to each row returned. i am trying to do so via a gridview. 

this is the asp code i am using:

<asp:GridView ID="GridViewMatters" runat="server" AutoGenerateColumns="False" OnRowDataBound="GridViewMatters_RowDataBound">
    <Columns>
        <asp:BoundField DataField="client_ref" HeaderText="Client Reference"/>
        <asp:BoundField DataField="ck_ref" HeaderText="Our Reference"/>
        <asp:BoundField DataField="first_name" HeaderText="First Name"/>
        <asp:BoundField DataField="second_name" HeaderText="Second Name"/>
        <asp:BoundField DataField="status" HeaderText="Status"/>
        <asp:TemplateField DataField="details" HeaderText="Details"/>
            <ItemTemplate>
                <asp :hyperlink ID="lnkDetails" runat="server" Text="Details" NavigateUrl="%# MD_Overall.aspx id= + Eval(client_ref) %">X marks the spot
            </ItemTemplate>
    </Columns>
</asp:GridView>

 

Wheni run it i get the follow error:

Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Type 'System.Web.UI.WebControls.TemplateField' does not have a public property named 'DataField'.
 

 


Answers (9)