text controls, when they change update the total control

I have 4 text field server controls formatted in currency like $1.00 like this one called Mastercard:


<td width="130" style="WIDTH: 130px">Mastercard
</td>
<td width="21" style="WIDTH: 21px"><INPUT onkeypress="return(currencyFormatCents(this,',','.','$',event))" id="Mastercard" type="text" name="Mastercard" runat="server" style="WIDTH: 116px; HEIGHT: 22px" size="14"></td>

When This control, or any of the other 4 I want to update a label control with their total (all 4 added together).

<DIV id=TotalCreditCards
style="DISPLAY: inline; WIDTH: 70px; HEIGHT: 15px"
ms_positioning="FlowLayout"></DIV></TD>

Thank you for any help
0
kdabda
1/8/2004 2:21:58 PM
asp.net.getting-started 91979 articles. 3 followers. Follow

7 Replies
556 Views

Similar Articles

[PageSpeed] 51

I would put a routine in the onkeypress method to add the values together and display them on the label.
0
KChapman
1/8/2004 3:04:09 PM
What if I have a routine already in the onkeypress, how can I add another one.  Or is there a method for when you leave the text field?
0
kdabda
1/8/2004 5:28:09 PM
Please take a look at this code.  I get 'object expected' error on the page as soon as I update the Lottery text field that does onblur="CreateTotal"  If I take out it out then I do not get the error.

Dim Section1Total as Decimal
Sub CreateTotal()
Section1Total = Lottery.Value + DriveOff.Value + drawer.Value + Other.Value
page.DataBind
End sub
If the below text field changes then I want Section1Total to be updated.

<INPUT onblur="CreateTotal" onkeypress="return(currencyFormatCents(this,',','.','$',event))" id="Lottery" type="text" name="Lottery" runat="server" style="WIDTH: 116px; HEIGHT: 22px" size="14"></TD>

Then this is the label that Section1Total goes into:

<asp:label id="Total" runat="server"
Text= '<%# Section1Total %>' Width="110px" Height="13px">


0
kdabda
1/8/2004 6:13:02 PM
Change this:


Sub CreateTotal()
Section1Total = Lottery.Value + DriveOff.Value + drawer.Value + Other.Value
page.DataBind
End sub

To:

Sub CreateTotal(ByVal sender As System.Object, ByVal e As System.EventArgs)
Section1Total = Lottery.Value + DriveOff.Value + drawer.Value + Other.Value
page.DataBind
End sub

Then try executing hte onblur="CreateTotal" again.
And make sure you declared all your form variables properly:

Lottery.Value + DriveOff.Value + drawer.Value + Other.Value

I am assuming they are textbox controls, so they need to be declared by using:

Protected WithEvents DriveOff As System.Web.UI.WebControls.TextBox
Protected WithEvents Lottery As System.Web.UI.WebControls.TextBox
Protected WithEvents drawer As System.Web.UI.WebControls.TextBox
Protected WithEvents OtherAs System.Web.UI.WebControls.TextBox


HTH
0
KChapman
1/8/2004 9:38:17 PM
Ah, just noticed you were using an HTML text control and not a web control. In that case you must declare them by using the following:


Protected WithEvents DriveOff As System.Web.UI.HtmlControls.HtmlInputText
Protected WithEvents Lottery As System.Web.UI.HtmlControls.HtmlInputText
Protected WithEvents drawer As System.Web.UI.HtmlControls.HtmlInputText
Protected WithEvents OtherAs As System.Web.UI.HtmlControls.HtmlInputText

0
KChapman
1/8/2004 9:42:14 PM
It already said that my HTML text controls were declared, so I did not include those lines of code but the rest I did word for word. I even added a button and have the onclick="CreateTotal"

Here is my vbscript
Sub CreateTotal(ByVal sender As System.Object, ByVal e As System.EventArgs)
Section1Total = Lottery.Value + DriveOff.Value + drawer.Value + Other.Value
page.DataBind
End sub
and the other Lottery control has

<INPUT onblur="CreateTotal" onkeypress="return(currencyFormatCents(this,',','.','$',event))" id="Lottery" style="WIDTH: 116px; HEIGHT: 22px" type="text" size="14" value="0" name="Lottery" runat="server"></TD>

When I click off Lottery textbox I get
Line: 507
Char: 1
Error 'CreateTotal' is undefined
when I click on the button I get the same error. Line 507 - doesn't not point to the correct place where 'CreateTotal' was called.
Thanks for the suggestions, any other ideas.
0
kdabda
1/9/2004 3:06:29 PM
Can you post line 507?
0
KChapman
1/9/2004 3:15:29 PM
Reply:

Similar Artilces:

Updating controls in datawindows as other controls are changed
Hi, I have a data window with various DropDownDataWindow controls. Changing a selection in one DDDWA will change the contents of some other controlsusing the itemchanged() function. At the moment changes are not displayed in the other controls until another field is selected. How can I get the contents to change in the other field as soon as the selection is made? Thanks for any help Hi If the changes are not displayed in the other controls, is because the code that you have in the itemchanged is not triggered till you select the option in the firt dddw and change to another fi...

Getting the control id of a control inside gridview control
 uhmm.. a little bit confusing regarding my subject because i dont know how to say it...by the way my problem is how can i get the id of a control (e.g. textbox) inside the gridview... and the textbox is in the templatefield... is there any way i can get its id??  hoping i could get a reply as soon as possible... Regards,MhaeyPlease remember to click “Mark as Answer” on the post that helps you.. =) What do you want's to do by getting the id of the Text box? Do you want's to find particular Textbox with certain id ? Kamran ShahidSr. Software Engineer(MCP,MCAD.net,MC...

Help me update related controls after a control was updated.
I have nested UserControls on page. What I need to do is to update Profile UserControl after an item was deleted from the list of items. We are using AJAX (ATLAS) in our project. Which principle do I need to use to accomplish that task? How would you do it? Thank you. "A successful person is one who can lay a firm foundation with the bricks that others throw at him." http://www.russiangeek.com/ hello. well, can you explain this a little better?-- Regards,Luis Abreuemail: labreu_at_gmail.comEN blog:http://msmvps.com/blogs/luisabreu Luis Abreu: hello. well...

Label control's text doesn't appear to be set (in the page which has a user control )when trying to update the text property in the FormView's ItemUpdated event
Hi There,I have a user control which hosts a formview control, gridview control and a label control. The grid view is usedto show rows in the DB and when clicked to edit each row, a form view opens up in edit mode with that particular row info. So I have nothing in the item template.My first question is..is it mandatory to have smth in the itemtemplate of the form view.I have controls in edititemtemplate and insertitemtemplate.When a particular row is edited, I would like to show a status msg showing that the row has been updated.For this, I use the ItemUpdated event of the formview and try ...

Getting/Updating and Binding a Control in the Edit Template of a Grid View Control
 Hi,               I am curious how do I update (or data bind) a drop down list in the edit template of a Grid View Control.             My problem is that in the GridView_RowEditing() method, the drop down list does not seem to exist. It only appears when the DropDownList_DataBound() method gets called. I can get the data for the DropDownList and attempt to bind it in this method, but then calling the DropDownList.DataBind()calls DropDownList_DataBound(), a...

chinese character in rich text control and text control
I have a chinese character in either rich text control or text control. The character is look fine if it is a small size (10, 12), however when the font size is changed bigger (36 or 72), the character is out of shape(many dot, not smooth). Is anyone has any idea to print a bigger chinese character from pb7.03. ...

Updating a Label control in one user control from another user control
Hi all, I have a main page in my music store site that has 5 user controls on it with 1 always showing main content and the others being things like a shopping cart, "best sellers", genre list etc (a la amazon). From the main content control I want to be able to set some label controls in my shopping basket control but I just can't seem to work out the syntax for how to do this: Here's the code I'm using - I'm trying to go to the 4th user control on the page (my shopping basket) then find the appropraite label, cast it locally as a Label then update the value: Label _so...

updateprogress control change other controls
I am using an updateprogress control to come on during an updatepanel. This works fine.But....I want the updateprogress control to turn off a <div>'s visibility OR change it's cssclass programatically. Do you know if this is possible? The problem...I am doing an in-page user availablilty check. If the client chooses a bad username....a div puts up a "X". If they then go in and fix it....instead of the "X" disappearing and the updateprogresscontrol Appearing......The "X" just stays there until it is replaced by whatever checkmark I set. Me...

Getting all the controls of Toolstrip control
Hi,     How will i be able to retrieve all the controls under toolstrip controls. Something like for all controls in me.controls....i need to access all the controls inside Toolstrip.  Let me know the options on how i would be able to achieve this. Thanks,Kris      ...

Get control in repeater control
Dear all, I want to use HtmlControls.HtmlTableCell in repeater control but i cant not access it,  in my table in Repeater Control,  i have 2 "td" which on page_load, i want to show only 1 of them depend on condition given. But i cant do it. This is my code : <asp:repeater id="repeaterViewNew" runat="server">                   <HeaderTemplate>                      <table width="100%" cellpadding="1" cellspacing="1">   &...

Issue with getting values from child controls in a gridview, to use for the update using a SQLDataSource control
Hi all, I have a gridview bound with a SQLDataSource. I am using the Update feature of the SQLDataSource to update a SQL Server database with values entered into the gridview. However I am not getting it to work. I believe this is due to the controls that contain the user entries are not the gridview itself, but rather child controls within the gridview. I have been using the names of the actual controls but nothing happens. Upon submit, the screen returns blank, and the database is not updated. Here is some code:   <asp:GridView ID="GridEditSettlement" runat="server" AutoGenerate...

Rich Text Edit control: get total pages?
Hi, can anyone think of a way I can get the total number of pages contained in a rich text edit control after having executed a DataSource() function? I need to switch back and forth between letterhead and regular paper when printing this 2-page document and the number of pages would help me write a loop. Since you are using DataSource function, to get the actual number of pages you can use: rte_1.PageCount ( ) * dw_1.Rowcount(), where dw_1 is the DW you have used in the Datasource function. Hope this helps. John. Rick Charnes wrote: > Hi, can anyone think of a way...

changing text in static text control
Hello PB 11 build 8123 I have a window with a dwcontrol. When I am updating the dw control I want one of the column names (static text controls) to change based on a value I select in another column. So far I have the code in the itemchanged to capture the value of my selection in the field I first select. How do I take this value, (it can only be Y or N) and program one of the column headings (static text) to display a certain text? I can't seem to get it to work with setitem or settext. Those two funcs don't really work with column headings as far as I can see. A...

Changing the text of an input (text) control
Hi everyone, please answer the following: I have a html input control as follows  <input id="newSearch_keywords" type="text" class="text" value="<%=JobsSearchBusinessObject.CurrentKeywords %>" name="newSearch_keywords""/>    When the page loads I need to look at the text of this input field and remove any * chars that are in the text. Thanks for your help <input id="newSearch_keywords" type="text" class="text" value="<%=JobsSearchBusinessObject.CurrentKeywords.Re...

Web resources about - text controls, when they change update the total control - asp.net.getting-started

Control - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

TERROR IN JAKARTA: 'Situation under control' after explosions, gunfire erupt in Indonesian capital
At least six people are dead, including three police officers, after several explosions at the Sarinah shopping mall in an apparent multi-site ...

DFES downgrades bushfire in Dunsborough as it is contained, but not under control
A BUSHFIRE south of Dunsborough has been contained but is not yet under control.

Queensland police shut down out-of-control party in Berserker, Rockhampton
Police shut down a party of 150 young people who had gathered at a house in Berserker, Rockhampton on Friday night.

Contextual and Granular Notification Controls
... written a lot about notifications, at one point calling the notifications screen “my home screen.” But I don’t like how we are forced to control ...

ESI cost control and networks
There is an interesting discussion thread on Twitter about how the way Medicare for All saves money is by significantly reducing provider, device, ...

While No One Was Watching, Obama Took Control of the Courts
... and President Obama’s legacy.” It didn’t favor conservatives but there was a dramatic shift to the far left. The appellate is under the control ...

Sanders Backs Gun Control Legislation Ahead of Democratic Debate
Hillary Clinton's campaign calls her rival's move a "debate-eve conversion."

Apple has landed a very rare sponsorship deal to ensure it has control of the hottest ticket in San Francisco ...
Apple has signed up for the first time to become a sponsor of the Super Bowl Host Committee, Daniel Roberts at Yahoo Finance reported. It's ...

Leonardo DiCaprio: The Oscar stuff is ‘completely beyond my control at this point’
... last night’s London premiere of The Revenant . Leo is looking pretty good these days. He’s de-bloated, his facial hair is very much under control, ...

Resources last updated: 1/18/2016 7:13:19 AM