user952072
user952072

Reputation: 107

gridview binding error even column is present in dataset

I am getting following error on gridview binding. DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'Sr'.

In my gridview itemtemplete i have a lable like this.

<asp:Label ID="lblQuesNo" runat="server" Text='<%#Eval("Sr.No.") %>'></asp:Label>

Sr.No. is present in dataset.

Upvotes: 0

Views: 71

Answers (1)

Bibhu
Bibhu

Reputation: 4081

Try this instead

<asp:Label ID="lblQuesNo" runat="server" Text='<%# DataBinder.GetPropertyValue(Container.DataItem, "Sr.No.") %>'></asp:Label>

Upvotes: 1

Related Questions