user1597398
user1597398

Reputation: 131

Unable to bind to the hyperlink

   <asp:HyperLink id=HyperLink1 
         Text='<%# Bind("report.reportId.ToString()") %>'       
         NavigateUrl='<%# Bind("~/manage.aspx") %>' 
         runat="server" />

I´m unable to run create this hyperlink as it gives me an error saying "A call to Bind was not well formatted. Please refer to documentation for the correct parameters to Bind."

Upvotes: 1

Views: 170

Answers (1)

KV Prajapati
KV Prajapati

Reputation: 94645

If it is simple data binding (no such data control is used) then use binding expression - <%# Expression %>. (I presume that the report.reportid is public)

 <asp:HyperLink 
         id=HyperLink1 
         Text='<%# report.reportId %>'       
         NavigateUrl="~/manage.aspx" 
         runat="server" />

and call the DataBind() method from code-behind,

public void page_load() { 
  DataBind();
}

Upvotes: 2

Related Questions