dynamic buttons

C

chxant

Hi,

I'm trying to develop a webapplication with a dynamic panel.
The first time the PanelResult is empty.
After the user clicked on the Login button I want to show a couple of
radiobuttons (from a database, so it has to be dynamic) and a new
button.
The code is below.
If I click on the "buttonGo" button, nothing happens.
Is it possible to add a button or radiobuttons dynamicly and to use the
information of the user?
Can I see the text of the clicked button in the page_load? This is the
solution I think.

Thanks for helping.

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

protected void Page_Load(object sender, EventArgs e)
{
}

protected void ButtonLogin_Click(object sender, EventArgs e)
{
RadioButton radioButtonMenu = new RadioButton();
RadioButton radioButtonLogo = new RadioButton();
radioButtonLogo.Text = "Logo";
radioButtonMenu.Text = "Menu";
Button buttonGo = new Button();
buttonGo.Text = "Go";
buttonGo.Click += new System.EventHandler(this.buttonGo_Click);

PanelResult.Controls.Add(radioButtonLogo);
PanelResult.Controls.Add(radioButtonMenu);
PanelResult.Controls.Add(buttonGo);

}

protected void buttonGo_Click(object sender, EventArgs e)

{
LabelTest.Text = "test";
}

</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:Table ID="TableTotaal" runat="server" Width="100%"
CellPadding=0 CellSpacing=0>
<asp:TableRow Height="120px">
<asp:TableCell Width="200px" VerticalAlign="middle"
HorizontalAlign="center"></asp:TableCell >
<%-- <asp:TableCell Width="200px" VerticalAlign="middle"
HorizontalAlign="center"><asp:Image ID="ImageEdit"
ImageUrl="~/edit.jpg" runat="server" Height="40"

Width="40" Visible="false" /> said:
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell VerticalAlign="top"
HorizontalAlign="left">
</asp:TableCell>
<asp:TableCell><asp:panel ID="PanelResult"
runat="server"/></asp:TableCell>
</asp:TableRow>
</asp:Table>
<asp:Label ID="LabelTest" runat="server" Width="523px"
ForeColor="Red"></asp:Label><br />
&nbsp;<br />
&nbsp;<br />
<asp:Button ID="ButtonLogin" runat="server" Text="login"
OnClick="ButtonLogin_Click" />
<br />

</form>
</body>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top