gridview not displaying in webpage

Posted by Su88rao under C# on 6/27/2013 | Points: 10 | Views : 530 | Status : [Member] | Replies : 2
i have to display grid view for the logged in user say for my manager i have written the stored procedure and back end code for it everything looks fine but grid view is not gettin populated please help me
back end code of grid view

public DataSet GetManager(MTMSDTO M)
{
DBAccess db = new DBAccess();
SqlParameter objParam = new SqlParameter("@EmpName", M.EmpName);
objParam.Direction = ParameterDirection.Input;
objParam.Size = 50;

db.Parameters.Add(objParam);
return db.ExecuteDataSet("GetManager");
}

public DataSet GetManager(MTMSDTO M)
{
MTMSAccess obj = new MTMSAccess();
return obj.GetManager(M);
}


protected void Page_Load(object sender, EventArgs e)
{
MTMSDTO objc = new MTMSDTO();

if (!IsPostBack)
{
GrdManager();
}
}

protected void GrdManager()
{
MTMSDTO objc = new MTMSDTO();
{
objc.EmpName = Convert.ToString(Session["EmpName"]);
DataSet GrdMA = obj.GetManager(objc);
DataView GrdMan = new DataView();
GrdMan.Table = GrdMA.Tables[0];
GridViewTTlist.DataSource = GrdMan;
GridViewTTlist.DataBind();
}
}
my stored procedure
ALTER PROCEDURE [dbo].[GetManager]

@EmpName nvarchar(50)

AS

Select TaskName, DueDate, Description, AssignBy, AssignTo, Status, PercentageComplete

From dbo.Task, dbo.EmployeeData

Where AssignTo in (Select EmpName From EmployeeData Where Manager = 'RaghavendraS')

And AssignBy in (Select EmpName From EmployeeData Where Manager = 'RaghavendraS')

And EmpName = @EmpName;




Responses

Posted by: Allemahesh on: 6/27/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
Please change the code as per below:-

if (GrdMA.Tables.Count > 0 && GrdMA.Tables[0].Rows.Count > 0)
{
GridViewTTlist.DataSource = GrdMA.Tables[0].DefaultView;
GridViewTTlist.DataBind();
}

Hope this will help.


Su88rao, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Su88rao on: 6/27/2013 [Member] Starter | Points: 25

Up
0
Down
should replace tis at protected void grid manager ()?

Su88rao, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response