i am getting error.
DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'totalRow'.
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: DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'totalRow'. Source Error:
Line 102: <asp:TemplateField HeaderText="Lead ">
Line 103: <ItemTemplate>
Line 104: <asp:Label ID="lead_count" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "totalRow") %>'></asp:Label>
Line 105: </ItemTemplate>
Line 106: </asp:TemplateField>
|
CREATE PROCEDURE SPlead_lage_count
AS
BEGIN
SET NOCOUNT ON
SELECT * FROM (
SELECT COUNT(b.INDICATER_TYPE)as totalRow,a.DEPARTMENT,b.INDICATER_TYPE
FROM emp_mast_lead_lag a
INNER JOIN lead_lag b ON a.EMPNO = b.EMPNO
GROUP BY a.DEPARTMENT,b.INDICATER_TYPE ) t
PIVOT (SUM(totalRow) FOR INDICATER_TYPE IN ([Leg],[Lead])
)P
END
protected void Button1_Click(object sender, EventArgs e)
{
connection();
query = "SPlead_lage_count";
SqlCommand com = new SqlCommand(query, con);
com.CommandType = CommandType.StoredProcedure;
SqlCommand cmd = new SqlCommand("SPlead_lage_count", con);
SqlDataAdapter da = new SqlDataAdapter(query, con);
DataSet ds = new DataSet();
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
SqlCommand _sqlCommand = new SqlCommand(query, con);
SqlDataReader dr;
dr = com.ExecuteReader();
if (dr.HasRows)
{
dr.Read();
GridView1.Visible = true;
ddl_Month.SelectedItem.Text = "";
Label1.Text = "";
}
else
{
GridView1.Visible = false;
Label1.Visible = true;
Label1.Text = "The Records " + ddl_Month.Text + " Is Not Available.";
}
}