Greetings,
I have a webcurrencyedit control inside of a webdialogwindow. I have some code that sets decimal places (banking software, it has to act like an adding machine - 600 would be 6.00). The code works fine on a control outside of the webdialogwindow. But on the control inside the webdialogwindow, it breaks. It can't find the webcurrencyedit.
My webcurrencyedit is named 'newDepositAmount'
I have tried the following, all unsuccessfully:
var DepositAmount = $find(newDepositAmount).innerText;
var DepositAmount = $find<%= newDepositAmount.ClientID %>").innerText;
var DepositAmount = document.getElementById"<%= lblValidation.ClientID %>).innerText
I need to get the text and then modify it and then reset it to the new value.
Please advise.
Hi,
I copied block of codes from your last message, reformatted it for lines, and tested.Considering your note, that it used to work without dialog, I assumed that the end of your block related to javascript was inserted into <script ...>.My block
<script type="text/javascript">function setNewDepositDecimalPlaces(){ var clientID = "<%=txtNewDepositAmount.ClientID%>"; var DepositAmount = igedit_getById(clientID); alert("NewValue=" + DepositAmount.getValue());}</script>
produced alert with correct value.
I would suggest you: do not use special feature of WebTextEdit which allows to use explicit javascript statements in ClientSideEvents, but use standard approach: name of function like ValueChange="setNewDepositDecimalPlaces". I also would suggest you to use "Add new hadler..." option in VisualDesigner editor for those properties. In this case you would get something like
function txtNewDepositAmount_ValueChange(oEdit, oldValue, oEvent){ //Add code to handle your event here.}
In this case you would not need to find reference to editor, because it is the first parameter (oEdit) in handler. It also provides old value and other abilities related to oEvent.
Note: VisualStudio2008 designer may fail to update aspx if property of a child located in container was modified from property pages. So, you may get around by temporary remove child (editor) from its container dialog, insert it directly in page, modify its properties and insert it back to original location. That problem is applied to almost all containers: Panel, UpdatePanel, WebDialogWindow, etc.
If you use WebCurrencyEdit control, then you should use only objects of that control. Below is example:
<asp:ScriptManager runat="server" ID="ScriptManager1" /><ig:WebDialogWindow ID="WebDialogWindow1" runat="server"> <ContentPane> <Template> <igtxt:WebCurrencyEdit ID="WebCurrencyEdit1" runat="server"></igtxt:WebCurrencyEdit> <input ID="Button2" type="button" value="button" onclick="click1()" /> </Template> </ContentPane></ig:WebDialogWindow>