存储过程正在执行但无法填充gridview [英] Stored procedure executing but not able to populate gridview

查看:54
本文介绍了存储过程正在执行但无法填充gridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在用户登录时填充gridview。我已经编写了一个存储过程,用于使用登录凭据填充该gridview ...我的存储过程正在运行...我能够在SQL Server中获取输出但是一旦我使用登录ID和密码并且gridview中的日志不是人口稠密...请帮帮我..



这是我的代码和存储过程



存储过程:

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;





我正在使用3层架构..它有DTO,DAL和业务层..我通过这些调用数据源层数。



后端代码



DAL:



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代码





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



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>

推荐答案

Hi Friend,

As you are saying that you are getting 9 records in DataView but still you are not getting records on your GridView then i think you are doing any mistake on Design page in HTML i think there is any css on gridview to hide Gridview, if possible then show your HTML Design Page for correct answer and check your css and properties at your end.
Hi Friend,
As you are saying that you are getting 9 records in DataView but still you are not getting records on your GridView then i think you are doing any mistake on Design page in HTML i think there is any css on gridview to hide Gridview, if possible then show your HTML Design Page for correct answer and check your css and properties at your end.


这篇关于存储过程正在执行但无法填充gridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆