页面加载时 Gridview 不显示
即使我已将 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 <> 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>
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为你没有传递 select 参数
I think you are not passing select parameter