When doing document.form1.item("txtHPoints").value it doesn't work when the control is inside the UltraWebTab control. How can I reference the value of this INPUT control inside the UltraWebTab?
Here is my page...if you move the controls outside the UltraWebTab then the document.form1.item("txtHPoints").value works find.
Thanks
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="test3.aspx.vb" Inherits="testing_test3" %><%@ Register Assembly="Infragistics2.WebUI.UltraWebTab.v7.3, Version=7.3.20073.38, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" Namespace="Infragistics.WebUI.UltraWebTab" TagPrefix="igtab" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"><title>Untitled Page</title><script language="javascript" type="text/javascript">function calcDollarAmount() { if (document.form1.item("txtHPoints").value != "") { document.form1.item("txtHDollars").value = "$" + CurrencyFormatted(parseFloat(document.form1.item("txtHPoints").value) / 100); } }function CurrencyFormatted(amount){ var i = parseFloat(amount); if(isNaN(i)) { i = 0.00; } var minus = ''; if(i < 0) { minus = '-'; } i = Math.abs(i); i = parseInt((i + .005) * 100); i = i / 100; s = new String(i); if(s.indexOf('.') < 0) { s += '.00'; } if(s.indexOf('.') == (s.length - 2)) { s += '0'; } s = minus + s; return s;}</script></head><body> <form id="form1" runat="server"> <div> <igtab:ultrawebtab id="UltraWebTab1" runat="server"><Tabs><igtab:Tab><ContentTemplate> Points<input id="txtHPoints" type="text" onchange="calcDollarAmount()" runat="server" /> <br /> Value<input id="txtHDollars" type="text" runat="server" /></ContentTemplate></igtab:Tab></Tabs></igtab:ultrawebtab> </div> </form></body></html>
Hi,
Hence, the UltraWebTab control is container control, objects inside WebTab have different client side Ids. You can use following client side Ids in your applictaion or use document.getElementById(id).
"UltraWebTab1_ctl00_txtHPoints"
"UltraWebTab1_ctl00_txtHDollars"
Looks like if my original ticket I failed to mention that I have nested UltraWebTabs and the controls are inside the child web tab control. If I had one UltraWebTab control, this does work, document.form1.item("UltraWebTab1_ctl00_txtHPoints").value.
How can I get to my control that inside nested UltraWebTab controls?
UltraWebTab1 = Parent
UltraWebTab2 = Child
txtHPoints is contained inside the UltraWebTab2 and is what I need to reference.
ajgould,
The UltraWebTab control is a naming container, which means that any controls inside one will have their client-side IDs modified to prevent mutltiple controls from having the same clientID. There are a couple of ways to work around this; you can find more information here.
Hope this helps,
~Kim~
Thank you for the reference, I followed Technique 2 and was unable to get the reference to the WebTextEdit control. Get 'document.Form1.TransferID' is null or not an object error after I type in some data into the WebTextEdit control.
Thank you for the help.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim TextEditorInsideTab As WebTextEdit TextEditorInsideTab = CType(UltraWebTab1.FindControl("WebTextEdit1"), WebTextEdit) TransferID.Value = TextEditorInsideTab.ClientID End Sub
<html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"><title>Untitled Page</title><script language="javascript" type="text/javascript">function calcDollarAmount() { alert(igedit_getById(document.Form1.TransferID.value)); }</script></head><body> <form id="form1" runat="server"> <igtab:ultrawebtab id="UltraWebTab1" runat="server"><Tabs><igtab:Tab> <ContentTemplate> <igtxt:WebTextEdit ID="WebTextEdit1" runat="server"> <ClientSideEvents ValueChange="calcDollarAmount" /> </igtxt:WebTextEdit> </ContentTemplate></igtab:Tab></Tabs></igtab:ultrawebtab><input type="hidden" runat="server" id="TransferID" /> </form></body></html>
Javascript is case-sensitive, and in your HTML the form's ID is "form1". Change the line that is erroring out to "document.form1.TransferID.value" and that should work.