TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Suraj Rao
NA
35
5.6k
Stored procedure executing but not able to populate gridview
Jun 28 2013 2:30 AM
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
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();
}
}
here is aspx code for grid view
<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" OnRowCreated="GridViewTTlist_RowCreated" >
<Columns>
<asp:BoundField DataField="TasKID" HeaderText="SL No" ReadOnly="True"
Visible="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" ForeColor="#0061C1" Height="24px"
Text="View" Width="70px" 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>
snapshot of rid views. 1st is of my tasks .. i hav written query like the employee who logs in and who has been assigned task can only view the grid and 2nd snapsht is for d user who assigns d task and the 3 rd snap is of manager... alternatively wen each user logs in he/she wnt b able to view othr than their respective grid view.....
Reply
Answers (
21
)
what was Error in my code?
How can i get the values of video metadata .........