473,396 Members | 1,961 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

can't get value from asp.net textbox inside wizard control using vb

2
I have an asp.net website I am designing using VS2005 standard. It is installed on Win2K3 Enterprise.
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
  1. <%@ Page Language="VB" %>
  2.  
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4.  
  5. <script runat="server">
  6.  
  7.     Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
  8.         Dim TextBoxOne As TextBox = Wizard1.FindControl("TextBox1")
  9.         Dim TextBoxTwo As TextBox = Wizard1.FindControl("TextBox2")
  10.         Dim LabelOne As Label = Wizard1.FindControl("Label1")
  11.         LabelOne.Text = (CDbl(TextBoxOne.Text) + CDbl(TextBoxTwo.Text))
  12.     End Sub
  13. </script>
  14.  
  15. <html xmlns="http://www.w3.org/1999/xhtml" >
  16. <head runat="server">
  17.     <title>Untitled Page</title>
  18. </head>
  19. <body>
  20.     <form id="form1" runat="server">
  21.     <div>
  22.         <asp:Wizard ID="Wizard1" runat="server">
  23.             <WizardSteps>
  24.                 <asp:TemplatedWizardStep ID="Test" runat="server" Title="Test">
  25.                     <ContentTemplate>
  26.                         <asp:TextBox ID="TextBox1" Text="0" runat="server"></asp:TextBox><br />
  27.                         <asp:TextBox ID="TextBox2" Text="0" runat="server"></asp:TextBox><br />
  28.                         <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label><br />
  29.                         <br />
  30.                         <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /><br />
  31.                     </ContentTemplate>
  32.                 </asp:TemplatedWizardStep>
  33.             </WizardSteps>
  34.         </asp:Wizard>
  35.  
  36.     </div>
  37.     </form>
  38. </body>
  39. </html>
Thanks in advance,
JTok
Jun 26 '07 #1
1 5825
JTok
2
I found a solution. I thought I would post it in case anyone else had the same problem.

Expand|Select|Wrap|Line Numbers
  1.     Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
  2.         Dim TextBoxOne As TextBox = Me.Test.ContentTemplateContainer.FindControl("TextBox1")
  3.         Dim TextBoxTwo As TextBox = Me.Test.ContentTemplateContainer.FindControl("TextBox2")
  4.         Dim LabelOne As Label = Me.Test.ContentTemplateContainer.FindControl("Label1")
  5.         LabelOne.Text = (CDbl(TextBoxOne.Text) + CDbl(TextBoxTwo.Text))
  6.     End Sub
Basically, I just have to use the name of the wizard template, and then use ContentTemplateContainer's FindControl to get the values from the asp.net textboxes.

- JTok
Jun 26 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: rodrigo | last post by:
This is what I am doing public class GridCustomPaging : System.Web.UI.Page { protected System.Web.UI.WebControls.DataGrid DgSearch;
0
by: datakix | last post by:
After 16 hours of frustration, I've managed to solve this problem for a project I'm working on. The 'trick' is set EnableViewState="False" for the asp:textbox inside the Repeater control. The...
0
by: jason | last post by:
Hello everyone. I am trying to write some custom command events into a DataGrid. The command that is currently giving me trouble is an "Add" custom command in the footer of a template column. ...
0
by: Seok Bee | last post by:
Dear Experts, I am having a wizard control in my web app. I have some textbox controls within the wizard control. At the same time, I have a hyperlink to run a pop-up window for calendar. The...
2
by: Dot Net Work | last post by:
I have a user control that contains a textbox and a link button. This UC sits inside a repeater control. When I click any button, any edited textbox value does not get sent back to the server...
2
by: VMI | last post by:
In the Page_Load() of my webForm, I have the following code, and on my HTML button, the onclick button calls writeVal() (the javascript function). When I click on the button, I see the messagebox...
3
by: mark4asp | last post by:
How can I stop my Calendar control from firing the form validation events? I have a form containing several controls which have several validation controls each. One control is a TextBox...
2
by: sudhashekhar30 | last post by:
hi all i am using 2 textbox in a step of wizard control.atleast one textbox should be filled among 2 textbox. how to validate this criteria. there is no button control. so not at the click of button...
7
by: adiel_g | last post by:
Hello Everyone, I created a custom control. On the CreateChildControls, I added a textbox to the control as follows: // TextBox TextBox txtValue = new TextBox(); txtValue.ID = "txtValue"; ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.