Wrox Programmer Forums
|
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 7th, 2008, 10:57 AM
Authorized User
 
Join Date: Nov 2007
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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?






Similar Threads
Thread Thread Starter Forum Replies Last Post
GridView sorting error snufse ASP.NET 2.0 Basics 0 February 12th, 2008 06:00 PM
GridView Error potato ASP.NET 2.0 Basics 0 April 8th, 2007 10:27 AM
Undefined Function Error arimakidd Beginning PHP 2 November 10th, 2005 02:54 AM
error in upload function blur_ivy .NET Web Services 0 February 26th, 2005 11:37 AM
nz function error bml Excel VBA 1 February 14th, 2005 12:52 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.