i have getting mention error.
Server Error in '/' Application.
A field or property with the name 'INDICATER_Desc' was not found on the selected data source.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Web.HttpException: A field or property with the name 'INDICATER_Desc' was not found on the selected data source. Source Error:
Line 47: da.Fill(ds);
Line 48: GridView1.DataSource = ds;
Line 49: GridView1.DataBind();
Line 50:
Line 51: }
|
protected void Button1_Click(object sender, EventArgs e)
{
connection();
string query = "SELECT COUNT(INDICATER_Desc) as totalRow FROM lead_lag1 WHERE INDICATER_Desc = 'NonReportable' group by INDICATER_Desc";
SqlDataAdapter da = new SqlDataAdapter(query, con);
DataSet ds = new DataSet();
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
}
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" AllowPaging="False" PageSize="10" Width="555px" horizontalalign="Right" >
<Columns>
<asp:BoundField ItemStyle-Width="250px" DataField="INDICATER_Desc" HeaderText="INDICATER_Desc " />
<asp:TemplateField HeaderText="Total Count ">
<ItemTemplate>
<asp:Label ID="lblamount_hotel" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "totalRow") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtEditamount_hotel" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "totalRow") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtAddtamount_hotel" runat="server" Width="80px"></asp:TextBox>
<asp:Label ID="lblTotal" runat="server" />
</FooterTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>