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"
<asp:TableRow>
<asp:TableCell VerticalAlign="top"
HorizontalAlign="left">
</asp:TableCell>
<asp:TableCell><aspanel ID="PanelResult"
runat="server"/></asp:TableCell>
</asp:TableRow>
</asp:Table>
<asp:Label ID="LabelTest" runat="server" Width="523px"
ForeColor="Red"></asp:Label><br />
<br />
<br />
<asp:Button ID="ButtonLogin" runat="server" Text="login"
OnClick="ButtonLogin_Click" />
<br />
</form>
</body>
</html>
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"
</asp:TableRow>Width="40" Visible="false" /> said:</asp:TableCell>
<asp:TableRow>
<asp:TableCell VerticalAlign="top"
HorizontalAlign="left">
</asp:TableCell>
<asp:TableCell><aspanel ID="PanelResult"
runat="server"/></asp:TableCell>
</asp:TableRow>
</asp:Table>
<asp:Label ID="LabelTest" runat="server" Width="523px"
ForeColor="Red"></asp:Label><br />
<br />
<br />
<asp:Button ID="ButtonLogin" runat="server" Text="login"
OnClick="ButtonLogin_Click" />
<br />
</form>
</body>
</html>