GridView Function error
I'm getting the following error
Server Error Application.
--------------------------------------------------------------------------------
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1502: The best overloaded method match for '_Default.NoOfCustomers(string)' has some invalid arguments
Source Error:
Line 130: <asp:TemplateField HeaderText="No. of Customers to be approved">
Line 131: <ItemTemplate>
Line 132: <asp:HyperLink ID="hlNoOfCustomers" runat="server" Text='<%# NoOfCustomers(Eval("Reseller"))%>' />
below is the gridview code
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource2">
<Columns>
<asp:BoundField DataField="Reseller" HeaderText="Reseller" SortExpression="Reseller" />
<asp:TemplateField HeaderText="No. of Customers to be approved">
<ItemTemplate>
<asp:HyperLink ID="hlNoOfCustomers" runat="server" Text='<%# NoOfCustomers(Eval("Reseller"))%>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:GoyamSEOConnectionString %>"
SelectCommand="SELECT distinct Reseller FROM [ResellersCustomer] WHERE ([Approved] = @Approved)">
<SelectParameters>
<asp:Parameter DefaultValue="false" Name="Approved" Type="Boolean" />
</SelectParameters>
</asp:SqlDataSource>
below is the function
public int NoOfCustomers(string ResellerName)
{
string dsn = ConfigurationManager.ConnectionStrings["MySqlConnection"].ConnectionString.ToString();
using (sqlCon = new SqlConnection(dsn))
{
string sqlSelect = "select count(*) from resellerscustomer where reseller='" + ResellerName + "' and approved =0";
sqlComm = new SqlCommand(sqlSelect, sqlCon);
sqlCon.Open();
int NoOfCustomers = (int)sqlComm.ExecuteScalar();
return NoOfCustomers;
}
}
any soln?
|