页面加载时 Gridview 不显示

发布于 2024-10-30 13:11:23 字数 5263 浏览 0 评论 0原文

即使我已将 gridview 与数据源绑定,当页面加载时,gridview 也不会显示...下面是代码...请帮助

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DSF_View_ChangeRequest.aspx.cs" Inherits="DSF_View_ChangeRequest" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
            <tr>
            <td align="center" class="style9" style="font-size: 1pt;">
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                ConnectionString="<%$ ConnectionStrings:QualityManagerConnectionString %>" 
                SelectCommand="SELECT TOP (100) PERCENT dbo.NCB_ProjectDashBoardView.ProjectNum, dbo.NCB_ChangeRequest.RequestNum, dbo.NCB_ChangeRequest.RequestStatus, dbo.NCB_ProjectDashBoardView.ProjectName, dbo.NCB_Release_DashBoardData.QA_Planned_EndDate, DATEPART(YEAR, dbo.NCB_Release_DashBoardData.QA_Planned_EndDate) AS Expr1, CASE WHEN IPMRefNum &lt;&gt; ProjectNum THEN IPMRefNum ELSE NULL END AS IPMRefNum, dbo.NCB_ProjectDashBoardView.ProposedPhaseName, dbo.NCB_ProjectDashBoardView.DependencyList FROM dbo.NCB_ProjectDashBoardView INNER JOIN dbo.NCB_Release_DashBoardData ON dbo.NCB_ProjectDashBoardView.ProjectNum = dbo.NCB_Release_DashBoardData.RequestNum INNER JOIN dbo.NCB_ChangeRequest ON dbo.NCB_ProjectDashBoardView.ProjectNum = LEFT (dbo.NCB_ChangeRequest.RequestNum, 7) WHERE (dbo.NCB_Release_DashBoardData.QA_Category = N'Release Handover') AND (dbo.NCB_Release_DashBoardData.QA_Planned_EndDate &gt; @param1) AND (dbo.NCB_Release_DashBoardData.QA_Planned_EndDate &lt; @param2) AND (dbo.NCB_ChangeRequest.RequestStatus &lt;&gt; 'Rejected') AND (dbo.NCB_ChangeRequest.RequestStatus &lt;&gt; 'Closed') ORDER BY dbo.NCB_ProjectDashBoardView.ProjectNum DESC">
                    <SelectParameters>
                        <asp:Parameter Name="param1" />
                        <asp:Parameter Name="param2" />
                    </SelectParameters>
            </asp:SqlDataSource>
                <br />
                <asp:ImageButton ID="ImageButton_Hdr_Help" runat="server" ImageUrl="~/Images/NCBLogo_QAManager_Trend_Dashboard.png"
                    OnClick="ImageButton_Hdr_Help_Click" />
            </td>
        </tr>
                            <tr>
                        <td style="font-size: 10pt; text-align: left" class="style6">
                            &nbsp;
                        </td>
                        <td style="font-size: 10pt; text-align: left;" class="style14">
                            &nbsp;
                        </td>
                        <td style="font-size: 10pt; text-align: left; color: #FFFFFF;" class="style3">
                            &nbsp;
                        </td>
                        <td style="font-size: 10pt; width: 218px; text-align: left; height: 19px;">
                        </td>
                    </tr>


<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
    CellPadding="4" DataSourceID="SqlDataSource1" ForeColor="#333333" 
    GridLines="None">
    <RowStyle BackColor="#EFF3FB" />
    <Columns>
        <asp:BoundField DataField="ProjectNum" HeaderText="ProjectNum" 
            SortExpression="ProjectNum" />
        <asp:BoundField DataField="RequestNum" HeaderText="RequestNum" 
            SortExpression="RequestNum" />
        <asp:BoundField DataField="RequestStatus" HeaderText="RequestStatus" 
            SortExpression="RequestStatus" />
        <asp:BoundField DataField="ProjectName" HeaderText="ProjectName" 
            SortExpression="ProjectName" />
        <asp:BoundField DataField="QA_Planned_EndDate" HeaderText="QA_Planned_EndDate" 
            SortExpression="QA_Planned_EndDate" />
        <asp:BoundField DataField="Expr1" HeaderText="Expr1" ReadOnly="True" 
            SortExpression="Expr1" />
        <asp:BoundField DataField="IPMRefNum" HeaderText="IPMRefNum" ReadOnly="True" 
            SortExpression="IPMRefNum" />
        <asp:BoundField DataField="ProposedPhaseName" HeaderText="ProposedPhaseName" 
            SortExpression="ProposedPhaseName" />
        <asp:BoundField DataField="DependencyList" HeaderText="DependencyList" 
            ReadOnly="True" SortExpression="DependencyList" />
    </Columns>
    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
    <EditRowStyle BackColor="#2461BF" />
    <AlternatingRowStyle BackColor="White" />
</asp:GridView>
</div>
</form>
</body>
</html>

The gridview is not displaying when the page load even though I have bind the gridview with the datasource.... below is the code... please help

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DSF_View_ChangeRequest.aspx.cs" Inherits="DSF_View_ChangeRequest" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
            <tr>
            <td align="center" class="style9" style="font-size: 1pt;">
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                ConnectionString="<%$ ConnectionStrings:QualityManagerConnectionString %>" 
                SelectCommand="SELECT TOP (100) PERCENT dbo.NCB_ProjectDashBoardView.ProjectNum, dbo.NCB_ChangeRequest.RequestNum, dbo.NCB_ChangeRequest.RequestStatus, dbo.NCB_ProjectDashBoardView.ProjectName, dbo.NCB_Release_DashBoardData.QA_Planned_EndDate, DATEPART(YEAR, dbo.NCB_Release_DashBoardData.QA_Planned_EndDate) AS Expr1, CASE WHEN IPMRefNum <> ProjectNum THEN IPMRefNum ELSE NULL END AS IPMRefNum, dbo.NCB_ProjectDashBoardView.ProposedPhaseName, dbo.NCB_ProjectDashBoardView.DependencyList FROM dbo.NCB_ProjectDashBoardView INNER JOIN dbo.NCB_Release_DashBoardData ON dbo.NCB_ProjectDashBoardView.ProjectNum = dbo.NCB_Release_DashBoardData.RequestNum INNER JOIN dbo.NCB_ChangeRequest ON dbo.NCB_ProjectDashBoardView.ProjectNum = LEFT (dbo.NCB_ChangeRequest.RequestNum, 7) WHERE (dbo.NCB_Release_DashBoardData.QA_Category = N'Release Handover') AND (dbo.NCB_Release_DashBoardData.QA_Planned_EndDate > @param1) AND (dbo.NCB_Release_DashBoardData.QA_Planned_EndDate < @param2) AND (dbo.NCB_ChangeRequest.RequestStatus <> 'Rejected') AND (dbo.NCB_ChangeRequest.RequestStatus <> 'Closed') ORDER BY dbo.NCB_ProjectDashBoardView.ProjectNum DESC">
                    <SelectParameters>
                        <asp:Parameter Name="param1" />
                        <asp:Parameter Name="param2" />
                    </SelectParameters>
            </asp:SqlDataSource>
                <br />
                <asp:ImageButton ID="ImageButton_Hdr_Help" runat="server" ImageUrl="~/Images/NCBLogo_QAManager_Trend_Dashboard.png"
                    OnClick="ImageButton_Hdr_Help_Click" />
            </td>
        </tr>
                            <tr>
                        <td style="font-size: 10pt; text-align: left" class="style6">
                             
                        </td>
                        <td style="font-size: 10pt; text-align: left;" class="style14">
                             
                        </td>
                        <td style="font-size: 10pt; text-align: left; color: #FFFFFF;" class="style3">
                             
                        </td>
                        <td style="font-size: 10pt; width: 218px; text-align: left; height: 19px;">
                        </td>
                    </tr>


<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
    CellPadding="4" DataSourceID="SqlDataSource1" ForeColor="#333333" 
    GridLines="None">
    <RowStyle BackColor="#EFF3FB" />
    <Columns>
        <asp:BoundField DataField="ProjectNum" HeaderText="ProjectNum" 
            SortExpression="ProjectNum" />
        <asp:BoundField DataField="RequestNum" HeaderText="RequestNum" 
            SortExpression="RequestNum" />
        <asp:BoundField DataField="RequestStatus" HeaderText="RequestStatus" 
            SortExpression="RequestStatus" />
        <asp:BoundField DataField="ProjectName" HeaderText="ProjectName" 
            SortExpression="ProjectName" />
        <asp:BoundField DataField="QA_Planned_EndDate" HeaderText="QA_Planned_EndDate" 
            SortExpression="QA_Planned_EndDate" />
        <asp:BoundField DataField="Expr1" HeaderText="Expr1" ReadOnly="True" 
            SortExpression="Expr1" />
        <asp:BoundField DataField="IPMRefNum" HeaderText="IPMRefNum" ReadOnly="True" 
            SortExpression="IPMRefNum" />
        <asp:BoundField DataField="ProposedPhaseName" HeaderText="ProposedPhaseName" 
            SortExpression="ProposedPhaseName" />
        <asp:BoundField DataField="DependencyList" HeaderText="DependencyList" 
            ReadOnly="True" SortExpression="DependencyList" />
    </Columns>
    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
    <EditRowStyle BackColor="#2461BF" />
    <AlternatingRowStyle BackColor="White" />
</asp:GridView>
</div>
</form>
</body>
</html>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爱本泡沫多脆弱 2024-11-06 13:11:23

我认为你没有传递 select 参数

               <SelectParameters>
                    <asp:Parameter Name="param1" />
                    <asp:Parameter Name="param2" />
                </SelectParameters>

I think you are not passing select parameter

               <SelectParameters>
                    <asp:Parameter Name="param1" />
                    <asp:Parameter Name="param2" />
                </SelectParameters>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文