In a Wizard Control, I want to take user input from two textboxes, add them together, and then display the results in a label when the user clicks a button.
I am using VB.
Here is an example of what I'm trying to do:
Expand|Select|Wrap|Line Numbers
- <%@ Page Language="VB" %>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <script runat="server">
- Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
- Dim TextBoxOne As TextBox = Wizard1.FindControl("TextBox1")
- Dim TextBoxTwo As TextBox = Wizard1.FindControl("TextBox2")
- Dim LabelOne As Label = Wizard1.FindControl("Label1")
- LabelOne.Text = (CDbl(TextBoxOne.Text) + CDbl(TextBoxTwo.Text))
- End Sub
- </script>
- <html xmlns="http://www.w3.org/1999/xhtml" >
- <head runat="server">
- <title>Untitled Page</title>
- </head>
- <body>
- <form id="form1" runat="server">
- <div>
- <asp:Wizard ID="Wizard1" runat="server">
- <WizardSteps>
- <asp:TemplatedWizardStep ID="Test" runat="server" Title="Test">
- <ContentTemplate>
- <asp:TextBox ID="TextBox1" Text="0" runat="server"></asp:TextBox><br />
- <asp:TextBox ID="TextBox2" Text="0" runat="server"></asp:TextBox><br />
- <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label><br />
- <br />
- <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /><br />
- </ContentTemplate>
- </asp:TemplatedWizardStep>
- </WizardSteps>
- </asp:Wizard>
- </div>
- </form>
- </body>
- </html>
JTok