<div id="divErrorCount" runat="server" class="page">
<asp:GridView ID="gvsummary" runat="server" AutoGenerateColumns="False" CellPadding="0"
Width="940px" BackColor="White" BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px"
Font-Bold="True" ForeColor="Black" Style="text-align: center">
<Columns>
<asp:TemplateField HeaderText="Unproductive Reason">
<ItemTemplate>
<asp:Label ID="lblunprodreasons" runat="server" Text='<%# Bind("unprodreasons") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Count">
<ItemTemplate>
<asp:Label ID="lblCount" runat="server" Text='<%# Bind("Count") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#CCCCCC" />
<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="#CCCCCC" />
</asp:GridView>
</div>
代码隐藏:名称“gvMyDetails”不会在目前情况下(asp.net,C#)存在的帮助,请
divErrorCount.Visible = true;
SqlDataReader myReader3 = null;
SqlCommand myCommand3 = new SqlCommand("SELECT unprodreasons, COUNT(unprodreasons) as Count FROM [myrecords] where username = '" + ddlrep.SelectedValue.Trim() + "' and (dates >= '" + datefrom + "' and dates <= '" + dateto + "') group by unprodreasons", myConnection);
myReader3 = myCommand3.ExecuteReader();
//myReader3.Read();
if (myReader3.HasRows)
{
gvsummary.DataSource = myReader3;
gvsummary.DataBind();
myReader3.Close();
}
else
{
myReader3.Close();
//divErrorCount.Visible = false;
}
-1没有照顾你自己的问题(没有格式化,没有解释)。 – 2012-07-10 16:38:19
代码转储中不存在名称'gvMyDetails'。错误发生在哪里?发布相关代码。 – LittleBobbyTables 2012-07-10 16:38:22
那么,_does_它存在吗?它没有提到你已经发布的任何代码。 – David 2012-07-10 16:38:51