The Best way to use Dynamic Buttons is DataList Make a DataList with item template containing a Button element. Bind the datalist with dataSource of buttons data collection. As
<asp:datalist id="dlButtons" runat="Server" onitemcommand="dlButtons_Command" xmlns:asp="#unknown">
<itemtemplate>
<asp:button id="cmdSubmit" text='<%# Eval( "Text" ) %>' runat="server" commandname='<%# Eval("Command") %>' />
</itemtemplate>
Now Handling on server Side on Page Load Event just bind the data source with Data List like As
List<Button> buttons = new List<Button>();
Button b1=new Button();
b1.Text="Previous";
b1.Command="Prev";
buttons.Add(b1);
Button b2=new Button();
b2.Text="Next";
b2.Command="Next";
buttons.Add(b2);
dlButtons.DataSource=buttons;
dlButtons.DataBind();
Now You can Write Button Action Code here
private void dlButtons_Command(object sender , DataListCommandEventArgs e)
{
if(e.Command == "Prev")
{
}
if(e.Command == "Next")
{
}
}
Ask if any issue comes ....