在C#.net中使用webservice处理具有三层体系结构的网格视图显示

在C#.net中使用webservice处理具有三层体系结构的网格视图显示,c#,asp.net,web-services,C#,Asp.net,Web Services,网格不显示在网页中,它不会获取任何错误或异常,但为什么它不工作在我出错的地方,我应该怎么做才能使其正确。 在这里,我添加了代码隐藏和webservice方法 代码隐藏 public void ShowGrid() { ServiceReference1.Service1Client client = new ServiceReference1.Service1Client(); DataTable dt = client.DisplayProductDe

网格不显示在网页中,它不会获取任何错误或异常,但为什么它不工作在我出错的地方,我应该怎么做才能使其正确。
在这里,我添加了代码隐藏和webservice方法

代码隐藏

 public void ShowGrid()
    {
        ServiceReference1.Service1Client client = new ServiceReference1.Service1Client();
        DataTable dt = client.DisplayProductDetails();
        grdView1.DataSource = dt;
        grdView1.DataBind();
    }

    public DataTable DisplayProductDetails()
    {
        DataTable dt;
        try
        {
            dt = new DataTable();
            dt = dal.ProductDetailsDisplay();
            return dt;
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }

    public DataTable ProductDetailsDisplay()
    {
        DataTable dt = new DataTable();
        SqlCommandBuilder cb;
        SqlDataAdapter adp;
        SqlConnection conn = new SqlConnection(constring);
        try
        {
            conn.Open();
            SqlCommand cmd = new SqlCommand("spDisplayProductDetails", conn);
            cmd.CommandType = CommandType.StoredProcedure;
            adp = new SqlDataAdapter(cmd);
            cb = new SqlCommandBuilder(adp);
            adp.Fill(dt);
            return dt;
        }
        catch (SqlException)
        {
            throw new Exception("");
        }
        catch (FormatException)
        {
            throw new Exception("Input Field supplied was not there in the correct Format");
        }
        catch (NullReferenceException)
        {
            throw new Exception("");
        }
        catch (Exception ex)
        {
            throw new Exception(ex.Message);
        }
        finally
        {
            if (conn.State == ConnectionState.Open)
            {
                conn.Close();
            }
        }
    }  
public class Service1 : IService1
{
    BllClass bll = new BllClass();
    public DataTable DisplayProductDetails()
    {
        return bll.DisplayProductDetails();
    }
    public void AddNewProduct(EntityClass en)
    {
        bll.AddNewProduct(en);
    }
    public void UpdateProductDetail(EntityClass en)
    {
        bll.UpdateProductDetail(en);
    }
    public void RemoveProduct(EntityClass en)
    {
        bll.RemoveProduct(en);
    }
}


[ServiceContract]
public interface IService1
{
    [OperationContract]
    DataTable DisplayProductDetails();
    [OperationContract]
    void AddNewProduct(EntityClass en);
    [OperationContract]
    void UpdateProductDetail(EntityClass en);
    [OperationContract]
    void RemoveProduct(EntityClass en);
    // TODO: Add your service operations here
}
网络服务代码

 public void ShowGrid()
    {
        ServiceReference1.Service1Client client = new ServiceReference1.Service1Client();
        DataTable dt = client.DisplayProductDetails();
        grdView1.DataSource = dt;
        grdView1.DataBind();
    }

    public DataTable DisplayProductDetails()
    {
        DataTable dt;
        try
        {
            dt = new DataTable();
            dt = dal.ProductDetailsDisplay();
            return dt;
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }

    public DataTable ProductDetailsDisplay()
    {
        DataTable dt = new DataTable();
        SqlCommandBuilder cb;
        SqlDataAdapter adp;
        SqlConnection conn = new SqlConnection(constring);
        try
        {
            conn.Open();
            SqlCommand cmd = new SqlCommand("spDisplayProductDetails", conn);
            cmd.CommandType = CommandType.StoredProcedure;
            adp = new SqlDataAdapter(cmd);
            cb = new SqlCommandBuilder(adp);
            adp.Fill(dt);
            return dt;
        }
        catch (SqlException)
        {
            throw new Exception("");
        }
        catch (FormatException)
        {
            throw new Exception("Input Field supplied was not there in the correct Format");
        }
        catch (NullReferenceException)
        {
            throw new Exception("");
        }
        catch (Exception ex)
        {
            throw new Exception(ex.Message);
        }
        finally
        {
            if (conn.State == ConnectionState.Open)
            {
                conn.Close();
            }
        }
    }  
public class Service1 : IService1
{
    BllClass bll = new BllClass();
    public DataTable DisplayProductDetails()
    {
        return bll.DisplayProductDetails();
    }
    public void AddNewProduct(EntityClass en)
    {
        bll.AddNewProduct(en);
    }
    public void UpdateProductDetail(EntityClass en)
    {
        bll.UpdateProductDetail(en);
    }
    public void RemoveProduct(EntityClass en)
    {
        bll.RemoveProduct(en);
    }
}


[ServiceContract]
public interface IService1
{
    [OperationContract]
    DataTable DisplayProductDetails();
    [OperationContract]
    void AddNewProduct(EntityClass en);
    [OperationContract]
    void UpdateProductDetail(EntityClass en);
    [OperationContract]
    void RemoveProduct(EntityClass en);
    // TODO: Add your service operations here
}
代码没有任何错误,但问题是网格没有显示?任何帮助都将不胜感激