<asp:DataList ID="dlstmovie" runat="server"
RepeatColumns="4"
RepeatDirection="Horizontal"
Width="100%"
CellPadding="4"
CellSpacing="4"
OnItemCommand="dlstmovie_ItemCommand">
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Visible="false" Text='<%#Eval("pyear") %>'>'>
</asp:Label>
<asp:Button ID="but1" runat="server" Width="114px" CommandName="but1_Click"
CssClass="contact-form" Text='<%#Eval("pyear") %>'/>
</ItemTemplate>
c# code
protected void show()
{
cn = new SqlConnection(cs);
cn.Open();
cm = new SqlCommand("select pyear from publishtb group by pyear ORDER BY pyear asc", cn);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cm);
da.Fill(ds);
dlstmovie.DataSource = ds;
dlstmovie.DataBind();
cn.Close();
}
RepeatColumns="4"
RepeatDirection="Horizontal"
Width="100%"
CellPadding="4"
CellSpacing="4"
OnItemCommand="dlstmovie_ItemCommand">
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Visible="false" Text='<%#Eval("pyear") %>'>'>
</asp:Label>
<asp:Button ID="but1" runat="server" Width="114px" CommandName="but1_Click"
CssClass="contact-form" Text='<%#Eval("pyear") %>'/>
</ItemTemplate>
c# code
protected void show()
{
cn = new SqlConnection(cs);
cn.Open();
cm = new SqlCommand("select pyear from publishtb group by pyear ORDER BY pyear asc", cn);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cm);
da.Fill(ds);
dlstmovie.DataSource = ds;
dlstmovie.DataBind();
cn.Close();
}
No comments:
Post a Comment