I need to populate a gridview upon user login. I have written a stored procedure for populating that gridview using login credentials... my stored procedure is working ... I'm able to get the output in SQL Server but once I use login id and password and logs in gridview isn't getting populated... please help me out..
This is my codes and stored procedure
Stored procedure:
ALTER PROCEDURE [dbo].[GetManager]
@EmpName nvarchar(50)
AS
Select TaskName, DueDate, Description, AssignBy, AssignTo, Status, PercentageComplete, TaskID
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;
I'm using 3 layered architecture.. wich has DTO,DAL and business layer.. I'm calling data source through these layers.
Backend code
DAL :
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");
}
BusinessLayer :
public DataSet GetManager(MTMSDTO M)
{
MTMSAccess obj = new MTMSAccess();
return obj.GetManager(M);
}
Gridview calling function using stored procedure:
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();
}
}
aspx code of grid view
<div class="Container" style="width: 99%; height: 370px;">
<asp:GridView ID="GridViewTTlist" runat="server" AllowSorting="True"
AutoGenerateColumns="false" BackColor="White" BorderColor="#0061C1"
BorderStyle="None" CaptionAlign="Bottom" EmptyDataText="No Records Found"
Font-Names="Verdana" Font-Size="X-Small" ForeColor="#0061C1"
Height="109px" OnRowDataBound="GridViewTTlist_RowDataBound"
ShowFooter="True" ShowHeaderWhenEmpty="True" Width="99%"
onselectedindexchanged="GridViewTTlist_SelectedIndexChanged" >
<Columns>
<asp:BoundField DataField="TaskID" HeaderText="SL No" Visible="true"
ReadOnly="false" >
<FooterStyle BackColor="#0061C1" />
<HeaderStyle BackColor="#0061C1"
HorizontalAlign="Center" VerticalAlign="Middle" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</asp:BoundField>
<asp:TemplateField HeaderText="Task Name">
<ItemTemplate>
<asp:Label ID="TaskName" runat="server"
Font-Names="Verdana" Font-Size="X-Small" Height="24px"
Text='<%# Eval("TaskName")%>' Width="70px"></asp:Label>
</ItemTemplate>
<FooterStyle BackColor="#0061C1" />
<HeaderStyle BackColor="#0061C1" ForeColor="White" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Due Date">
<ItemTemplate>
<asp:Label ID="DueDate" runat="server"
Font-Names="Verdana" Font-Size="X-Small"
Height="20px" Width="70px" Text='<%# Eval("DueDate","{0:dd/MM/yyyy}")%>' DataFormatString="{0:dd/MM/yyyy}"></asp:Label>
</ItemTemplate>
<FooterStyle BackColor="#0061C1" />
<HeaderStyle BackColor="#0061C1" ForeColor="White" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Description">
<ItemTemplate>
<asp:Label ID="Description" runat="server"
Font-Names="Verdana" Font-Size="X-Small" Height="20px" Width="90px" Text='<%# Eval("Description")%>'></asp:Label>
</ItemTemplate>
<FooterStyle BackColor="#0061C1" />
<HeaderStyle BackColor="#0061C1" ForeColor="White" />
<ItemStyle HorizontalAlign="Left" VerticalAlign="Middle" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Assign By">
<ItemTemplate>
<asp:Label ID="AssignBy" runat="server"
Font-Names="Verdana" Font-Size="X-Small" Height="20px" Width="60px" Text='<%# Eval("AssignBy")%>'></asp:Label>
</ItemTemplate>
<FooterStyle BackColor="#0061C1" />
<HeaderStyle BackColor="#0061C1" ForeColor="White" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Assign To">
<ItemTemplate>
<asp:Label ID="AssignTo" runat="server"
Font-Names="Verdana" Font-Size="X-Small" Height="20px" Width="90px" Text='<%# Eval("AssignTo")%>'></asp:Label>
</ItemTemplate>
<FooterStyle BackColor="#0061C1" />
<HeaderStyle BackColor="#0061C1" ForeColor="White" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Status">
<ItemTemplate>
<asp:Label ID="Status" runat="server"
Font-Names="Verdana" Font-Size="X-Small" Height="20px" Width="90px" Text='<%# Eval("Status")%>'></asp:Label>
</ItemTemplate>
<FooterStyle BackColor="#0061C1" />
<HeaderStyle BackColor="#0061C1" ForeColor="White" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</asp:TemplateField>
<asp:TemplateField HeaderText="% Complete">
<ItemTemplate>
<asp:Label ID="PercentageComplete" runat="server"
Font-Names="Verdana" Font-Size="X-Small"
Height="20px" Width="68px" Text='<%# Eval("PercentageComplete")%>'></asp:Label>
</ItemTemplate>
<FooterStyle BackColor="#0061C1" />
<HeaderStyle BackColor="#0061C1" ForeColor="White" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</asp:TemplateField>
<asp:TemplateField HeaderText="View Details">
<ItemTemplate>
<asp:HyperLink ID="ViewDetails" runat="server" Font-Names="Verdana" Font-Size="X-Small" Height="24px"
Width="70px" ForeColor="#0061C1" Text="ViewDetails"
NavigateUrl="Reports.aspx" DataNavigateUrlFields="TaskID" DataNavigateUrlFormatString="Reports.aspx?TaskID={0}">View</asp:HyperLink>
</ItemTemplate>
<FooterStyle BackColor="#0061C1" />
<HeaderStyle BackColor="#0061C1" ForeColor="White" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</asp:TemplateField>
</Columns>
</asp:GridView>
<div>
text/css file
<asp:Content ID="Content2" runat="server" contentplaceholderid="head">
<style type="text/css">
.Container
{
overflow: auto;
}
.ButtonClass
{
cursor : pointer;
}
.style18
{
height: 23px;
}
.style26
{
width: 1000px;
height: 89px;
}
.style40
{
color: #0061C1;
}
.style50
{
width: 14px;
height: 425px;
}
.style51
{
width: 608px;
height: 425px;
}
.style52
{
height: 425px;
width: 18px;
}
.style86
{
height: 89px;
}
.style87
{
width: 82px;
}
.style89
{
width: 1000px;
height: 69px;
}
.style91
{
width: 82px;
height: 49px;
}
.style115
{
width: 27px;
}
.style118
{
width: 147px;
font-weight: 700;
color: #0061C1;
font-family: Verdana;
font-size: small;
height: 46px;
text-align: left;
}
.style121
{
width: 257px;
font-weight: 700;
color: #0061C1;
font-family: Verdana;
font-size: small;
height: 46px;
text-align: left;
}
.style122
{
height: 49px;
}
.style123
{
width: 27px;
height: 23px;
}
.style124
{
height: 69px;
}
.style125
{
width: 82px;
height: 1px;
}
.style126
{
height: 1px;
}
.style127
{
width: 27px;
height: 68px;
}
.style128
{
height: 68px;
}
</style>