【发布时间】:2013-11-22 16:08:43
【问题描述】:
大家好,我的 asp.net 网页中有一个转发器控件。我想从转发器控件中选择月份,并从该月的基础上获取我在该月发布的所有数据这是转发器控件的源代码。
<asp:Repeater ID="Repeater1" runat="server"
onitemcommand="Repeater1_ItemCommand">
<ItemTemplate>
<ul class="archive">
<li><a href="#">
<%#Eval("mnth") %>
<%#Eval("yr") %><span>(<%#Eval("totalcount") %>)</span>
<%--<asp:Label ID="Label6" runat="server" Text="<%#Eval("mnth") %>">
<asp:Label ID="Label8" runat="server" Text="<%#Eval("yr") %>"></asp:Label><span> (
<asp:Label ID="Label7" runat="server" Text="<%#Eval("totalcount") %>"></asp:Label> ) </span> </a></li>--%>
</ul>
</ItemTemplate>
</asp:Repeater>
这是我用来绑定中继器控件的代码
private void BindPostCounts()
{
SqlCommand cmdBindCounts = new SqlCommand("CountBlogPost_sp", con);
cmdBindCounts.CommandType = CommandType.StoredProcedure;
SqlDataAdapter daBindCounts = new SqlDataAdapter(cmdBindCounts);
DataSet dsBindCount = new DataSet();
daBindCounts.Fill(dsBindCount);
Repeater1.DataSource = dsBindCount;
Repeater1.DataBind();
}
这是我正在使用的表格
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[BlogPost](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Title] [varchar](500) NULL,
[Blogpost] [nvarchar](max) NULL,
[Paramlink] [varchar](500) NULL,
[PostDate] [datetime] NULL,
[IsActive] [int] NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
现在基于所选月份我想获取我在该月发布的数据请告诉我我必须在哪个事件上工作
【问题讨论】:
-
请指定您从中获取数据的表的相关信息
-
@Rony 请检查我编辑我的问题添加我的表
-
@AzadChohan - 使用带有隐藏字段的 ID....