G
Guest
Hi,
Using ASP .Net,
I'm trying to create a ImageButton when the user clicks on a button,
this is my code:
protected void logout_btn_Click(object sender, ImageClickEventArgs e)
{
ImageButton ib = new ImageButton();
ib.ID = "IWantToPlay";
ib.ImageUrl = "~Images/basketballPlayers.jpg";
ib.Width = 45;
this.Controls.Add(ib);
}
i get the following error:
Control 'IWantToPlay' of type 'ImageButton' must be placed inside a form tag
with runat=server.
how can i create the imageButton dynamiclly?
Thanks,
Gidi
Using ASP .Net,
I'm trying to create a ImageButton when the user clicks on a button,
this is my code:
protected void logout_btn_Click(object sender, ImageClickEventArgs e)
{
ImageButton ib = new ImageButton();
ib.ID = "IWantToPlay";
ib.ImageUrl = "~Images/basketballPlayers.jpg";
ib.Width = 45;
this.Controls.Add(ib);
}
i get the following error:
Control 'IWantToPlay' of type 'ImageButton' must be placed inside a form tag
with runat=server.
how can i create the imageButton dynamiclly?
Thanks,
Gidi