CodeVerge.Net Beta
Login Idy
Register Password
  Forgot?
   Explore    Item Entry    Profile    Invite   History    Resources   SiteMap  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML




Zone: > newsgroup > asp.net forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 1/14/2008 7:59:25 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 14 Views: 9 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
15 Items, 1 Pages 1 |< << Go >> >|
Big Red
Asp.Net User
Set numeric textbox value in javascript1/14/2008 7:59:25 PM

0/0

My main question is: How do I set the value/text of a numerica text box in javascript code?

I'm using Visual Studio 2008 with Q3. I have a master page with numerous content pages. On one page i have a few numeric textboxes. I have been able to grab the values of the textboxes and do any calculations with them that I need, but I have not been able to write my values into another textbox. How do I do this? Here's all my code for this so far.
(Masterpage)

<%@ Master Language="VB" CodeFile="MasterPage.master.vb" Inherits="MasterPage" %> 
 
<!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> 
    <asp:ContentPlaceHolder id="head" runat="server">  
    </asp:ContentPlaceHolder> 
</head> 
<body bgcolor="#cccccc">  
    <form id="form1" runat="server">  
    <div> 
     <script type="text/javascript">    
      function TestCalc(te, ca, db)  
                {  
                    alert("Calculating");  
                    var totalExpenses = document.getElementById(te).value;  
                    var cashAdvance = document.getElementById(ca).value;  
                    var directBillings = document.getElementById(db).value;  
                    var due = (totalExpenses - cashAdvance - directBillings);  
                    //cashAdvance.SetValue(directBillings);  
                    //cashAdvance.innerHTML = 0;  
                    //ca.innerHTML = 0;  
                    //document.getElementById(ca).innerHTML = "0";  
 
//                    if (due < 0)  
//                    {  
//                        var DueAmount = (due * (-1));  
//                        var DueEmployer = document.getElementById(der);  
//                        alert(DueEmployer.value);  
//                        DueEmployer.Value = DueAmount;  
//                        alert(DueEmployer.value);  
//                          
//                    }  
//                    else{  
//                        var DueAmount = due;  
//                        var DueEmployee = document.getElementById(dee).value;  
//                        dee.SetValue(DueAmount);  
//                    }  
                                        
                }  
     </script>
 
        <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">  
          
        </asp:ContentPlaceHolder> 
    </div> 
    </form> 
</body> 
</html>

Default.aspx

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load  
        RadNumericTextBox1.Attributes.Add("onBlur", "TestCalc('" & RadNumericTextBox1.ClientID & "', '" & RadNumericTextBox2.ClientID & "', '" & RadNumericTextBox3.ClientID & "')")  
    End Sub

 

<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" title="Untitled Page" %> 
 
<%@ Register assembly="RadInput.Net2" namespace="Telerik.WebControls" tagprefix="rad" %> 
 
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">  
</asp:Content> 
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">  
    <p> 
    <br /> 
    <table style="width: 27%;">  
        <tr> 
            <td> 
                <rad:RadNumericTextBox ID="RadNumericTextBox1" Runat="server">  
                </rad:RadNumericTextBox> 
            </td> 
            <td> 
                &nbsp;</td> 
            <td> 
                &nbsp;</td> 
        </tr> 
        <tr> 
            <td> 
                <rad:RadNumericTextBox ID="RadNumericTextBox2" Runat="server">  
                </rad:RadNumericTextBox> 
            </td> 
            <td> 
                &nbsp;</td> 
            <td> 
                &nbsp;</td> 
        </tr> 
        <tr> 
            <td> 
                <rad:RadNumericTextBox ID="RadNumericTextBox3" Runat="server">  
                </rad:RadNumericTextBox> 
            </td> 
            <td> 
                &nbsp;</td> 
            <td> 
                &nbsp;</td> 
        </tr> 
    </table> 
</p> 
</asp:Content>

 

Any help would be greatly appreciated.  Please let me know if you need any other information or have questions.  Thanks!

Amanda

MorningZ
Asp.Net User
Re: Set numeric textbox value in javascript1/14/2008 8:40:42 PM

0/0

This would be a start, you have the lines:

var DueEmployer = document.getElementById(der);  

and

var DueEmployee = document.getElementById(dee).value;

but no where else in the code do you define what "dee" and "der" are


"If you make it idiot proof, they'll build a better idiot"
Big Red
Asp.Net User
Re: Set numeric textbox value in javascript1/14/2008 8:44:16 PM

0/0

That's because that's for my main program. I created a test program with just the first three variables (textboxes).  So I just commented those lines out because I don't need them.  So basically pretend like those lines aren't there.  The commented out code above those lines are the ones I've tried and haven't worked at all.

Rinze
Asp.Net User
Re: Set numeric textbox value in javascript1/14/2008 8:59:35 PM

0/0

By using a masterpage, the id's of your textboxes will change. To ensure unique names in your pages, they get a contentplacehodler prefix. Have a look at the rendered textboxes and fieldnames (in the html source code) to see what the id's are and use them in your getElementById calls.


Hope this helps !
Rinze

---------
please select 'mark as answer' if this post helped you!
Big Red
Asp.Net User
Re: Set numeric textbox value in javascript1/14/2008 9:05:51 PM

0/0

Yes, I understand that the ID's change with master pages.  This is why I send the clientID of each textbox to the javascript in the master page.  This is like the unique ID for each box.  In my code I did a test and did an alert for each textbox.  I can grab the values of each textbox just fine.  I just can't put a value into a textbox though to change the value.

MorningZ
Asp.Net User
Re: Set numeric textbox value in javascript1/14/2008 9:14:24 PM

0/0

" I just can't put a value into a textbox though to change the value."

Which textbox?  in your javascript (which should be on the content page btw, since it probably doesn't need to be application wide) you read the three textboxes in your page but you do not say anywhere so far what the target of that calculated value is....

regardless of where that target is or whatever, the javascript code would simply be:

document.getElementById(<id of target textbox>).value = due;
 


"If you make it idiot proof, they'll build a better idiot"
Big Red
Asp.Net User
Re: Set numeric textbox value in javascript1/14/2008 9:23:02 PM

0/0

I actually have no idea how to put the javascript in the content page.  do you know how?  Everywhere I've looked it's said to use the master page for all the javascript.

And in my main program, I have 5 textboxes..  I use the first three for the calculations and then the last two are the ones that I want to populate, whether the number is negative or positive.  In my sample one, it doesn't matter which textbox I put a value into, i just want it to work with one or any of them.  And you're sample javascript code is what i thought i would have to do, but that doesn't work.  I'm not sure if it's because of the master/content pages or not.

MorningZ
Asp.Net User
Re: Set numeric textbox value in javascript1/14/2008 9:42:22 PM

0/0

Big Red:

I actually have no idea how to put the javascript in the content page.  do you know how?  Everywhere I've looked it's said to use the master page for all the javascript.



Notice in the Master page there is a Content Place Holder inside the <head></head> tags, this gives you the ability to have page-specific styles/javascript/whatever, so in your case you posted your ASPX code, the code would go:

<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" title="Untitled Page" %> 
 
<%@ Register assembly="RadInput.Net2" namespace="Telerik.WebControls" tagprefix="rad" %> 
 
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">  
    Your javascript <script> block here for this page
</asp:Content>
 

 and that script would be inside the page's header


Big Red:

And in my main program, I have 5 textboxes..  I use the first three for the calculations and then the last two are the ones that I want to populate, whether the number is negative or positive.  In my sample one, it doesn't matter which textbox I put a value into, i just want it to work with one or any of them.  And you're sample javascript code is what i thought i would have to do, but that doesn't work.  I'm not sure if it's because of the master/content pages or not.

 

Where are those two other textboxes?  your example code has only three.....     and rest assured that document.getElemenyById('id of textbox 4 or 5').value does work, you're just not implementing it correctly (probabaly because you aren't using the full masterpage-mangled id of the control), and it's hard for anyone to tell you whats wrong with your code because, well, you aren't showing it  :-) 


"If you make it idiot proof, they'll build a better idiot"
MorningZ
Asp.Net User
Re: Set numeric textbox value in javascript1/14/2008 10:12:42 PM

0/0

 btw, how do you like that Telerik control set?   Does it make life easier?      We've been eying it for a while but just haven't really grasped if it's worth the cost


"If you make it idiot proof, they'll build a better idiot"
Big Red
Asp.Net User
Re: Set numeric textbox value in javascript1/15/2008 1:58:31 PM

0/0

Okay, so I'm trying to put the javascript into the Default page.  Here's my code now (with 4 textboxes - 1 for the value from my calculation)

<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" title="Untitled Page" %>

<%@ Register assembly="RadInput.Net2" namespace="Telerik.WebControls" tagprefix="rad" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">

<script type="text/javascript">

function TestCalc()

{

var tempCalc = 0.0;

alert("Calculating");

var totalExpenses = document.getElementById("<%= RadNumericTextBox1.ClientID %>").value;

var cashAdvance = document.getElementById("<%= RadNumericTextBox2.ClientID %>").value;

var directBillings = document.getElementById("<%= RadNumericTextBox3.ClientID %>").value;

 

var due = (totalExpenses - cashAdvance - directBillings);

alert(due);

 

document.getElementById(
"<%= RadNumericTextBox4.ClientID %>").value = due;

 

}

</script>

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<p>

&nbsp;<rad:RadNumericTextBox ID="RadNumericTextBox2" Runat="server">

</rad:RadNumericTextBox>

<rad:RadNumericTextBox ID="RadNumericTextBox3" Runat="server">

</rad:RadNumericTextBox>

<rad:RadNumericTextBox ID="RadNumericTextBox1" Runat="server">

</rad:RadNumericTextBox>

<rad:RadNumericTextBox ID="RadNumericTextBox4" Runat="server">

</rad:RadNumericTextBox>

</p>

</asp:Content>

   Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        RadNumericTextBox1.Attributes.Add("onBlur", "TestCalc()")
    End Sub

 

I'm still getting the same problem as before....  I'm grabbing the values alright and the calculation is doing alright, but it won't put the value into the fourth textbox.  This is where I want to put the value from my calculation into, but it's not puting it in there.  any idea why?

 

And to answer your last post, YES... I LOVE the rad controls!!!!  I have so much more flexibility and options now!  Plus, it makes everything look SO much better and clean!!!  I would definitely recommend the RAD controls for your web applications.

MorningZ
Asp.Net User
Re: Set numeric textbox value in javascript1/15/2008 8:25:06 PM

0/0

 what happens when you say this in your javascript?

 

alert(due);
alert(document.getElementById("<%= RadNumericTextBox4.ClientID %>"));
alert(document.getElementById(
"<%= RadNumericTextBox4.ClientID %>").value);

 

 if the second line says "undefined", then that means for some reason your script can't see the control on the page, i would suggest doing a "View Source", find the actual HTML for that 4th control and absolutely positively make sure the ID parameter matches what your server side <%= %> is spitting out


"If you make it idiot proof, they'll build a better idiot"
Big Red
Asp.Net User
Re: Set numeric textbox value in javascript1/15/2008 8:36:23 PM

0/0

Well, nether alert says 'undefined.'  The first one actually says [object] and the second just shows a box... no value, no nothing, just the box with the OK button.  Here's my page source after the javascript runs..  I think everything looks alright.  See any errors or anything interesting that would help me?  Thanks!

2   
3    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4   
5    <html xmlns="http://www.w3.org/1999/xhtml">
6    <head><title>
7    Untitled Page
8    </title>
9    <script type="text/javascript"
10         function TestCalc()
11                   {
12                   var tempCalc = 0.0;
13                       alert("Calculating");
14                       var totalExpenses = document.getElementById("ctl00_ContentPlaceHolder1_RadNumericTextBox1").value;
15                       var cashAdvance = document.getElementById("ctl00_ContentPlaceHolder1_RadNumericTextBox2").value;
16                       var directBillings = document.getElementById("ctl00_ContentPlaceHolder1_RadNumericTextBox3").value;
17                   
18                       var due = (totalExpenses - cashAdvance - directBillings);
19                       alert(due);
20                       alert(document.getElementById("ctl00_ContentPlaceHolder1_RadNumericTextBox4"));
21                       alert(document.getElementById("ctl00_ContentPlaceHolder1_RadNumericTextBox4").value);
22  
23                     
24                       document.getElementById("ctl00_ContentPlaceHolder1_RadNumericTextBox4").value = due;
25                     
26                   }
27        </script>
28   <link type="text/css" rel="stylesheet" href="/TestCalc/WebResource.axd?d=oZ--AfSbup__fXP-L8VRTZrG5IE0YvPFUm8bkG-8Sq-t-5zl3PTSEj_XOWo_YD3F0sEJ8iaWI0Nk4nPZN8yQ6-mIDfrsNnXUJ0ZCkiGxmdM1&amp;t=633334901220000000" /></head>
29   <body bgcolor="#cccccc">
30       <form name="aspnetForm" method="post" action="Default.aspx" id="aspnetForm">
31   <div>
32   <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="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" />
33   </div>
34  
35       <div>
36       
37          
38       <p>
39        <div id="ctl00_ContentPlaceHolder1_RadNumericTextBox2_wrapper" class="radInput_Default" style="display:inline;zoom:1;width:125px;">
40   <!-- 2.1.2 --><script type="text/javascript" src="/TestCalc/WebResource.axd?d=oZ--AfSbup__fXP-L8VRTZrG5IE0YvPFUm8bkG-8Sq-t-5zl3PTSEj_XOWo_YD3FikzrNrpGkGNN1LH8l2yF85uR-b3hrY2pDPWbFDew09o1&t=633334901220000000"></script><script type="text/javascript" src="/TestCalc/WebResource.axd?d=oZ--AfSbup__fXP-L8VRTZrG5IE0YvPFUm8bkG-8Sq-t-5zl3PTSEj_XOWo_YD3FikzrNrpGkGNN1LH8l2yF87Lq893SCSrLApn4bOQm5V81&t=633334901220000000"></script><span id="ctl00_ContentPlaceHolder1_RadNumericTextBox2StyleSheetHolder" style="display:none;"></span><table cellpadding="0" cellspacing="0" style="border-width:0;border-collapse:collapse;table-layout:fixed;width:100%;">
41   <tr>
42   <td class="inputCell" style="width:100%;"><input type="text" id="ctl00_ContentPlaceHolder1_RadNumericTextBox2_text" class="radEnabledCss_Default" style="width:100%;" /><input style="visibility:hidden;position:absolute;right:0;width:0;height:0;overflow:hidden;border:0;padding:0;margin:0;" id="ctl00_ContentPlaceHolder1_RadNumericTextBox2" value="" type="text" /><input style="visibility:hidden;position:absolute;right:0;width:0;height:0;overflow:hidden;border:0;padding:0;margin:0;" id="ctl00_ContentPlaceHolder1_RadNumericTextBox2_Value" name="ctl00$ContentPlaceHolder1$RadNumericTextBox2" value="" type="text" /></td>
43   </tr>
44   </table><script type="text/javascript">window["ctl00_ContentPlaceHolder1_RadNumericTextBox2"] = new RadNumericTextBox("ctl00_ContentPlaceHolder1_RadNumericTextBox2", {"IncrementSettings":{"Step":1,"InterceptArrowKeys":true,"InterceptMouseWheel":true},"ShowSpinButtons":false,"MaxValue":70368744177664,"MinValue":-70368744177664,"SelectionOnFocus":3,"NumberFormat":{"DecimalSeparator":".","AllowRounding":true,"DecimalDigits":2,"GroupSizes":3,"GroupSeparator":",","NegativePattern":"-n","PositivePattern":"n","NegativeSign":"-"},"PostBackEventReferenceScript":"","AutoPostBack":false,"EmptyMessage":"","ClientEvents":{"OnError":"","OnButtonClick":"","OnLoad":"","OnMouseOut":"","OnMouseOver":"","OnFocus":"","OnBlur":"","OnDisable":"","OnEnable":"","OnValueChanged":"","OnKeyPress":"","OnEnumerationChanged":"","OnMoveUp":"","OnMoveDown":"","OnShowHint":""},"ShowButton":false,"ButtonsPosition":1,"Enabled":true}, {HoveredStyle: ["width:125px;", "radHoverCss_Default"],InvalidStyle: ["width:125px;", "radInvalidCss_Default"],DisabledStyle: ["width:125px;", "radDisabledCss_Default"],FocusedStyle: ["width:125px;", "radFocusedCss_Default"],EmptyMessageStyle: ["width:125px;", "radEmptyMessageCss_Default"],EnabledStyle: ["width:125px;", "radEnabledCss_Default"],NegativeStyle: ["width:125px;", "radNegativeCss_Default"]});window["ctl00_ContentPlaceHolder1_RadNumericTextBox2"].OriginalValue = '';</script>
45   </div>
46                   <div id="ctl00_ContentPlaceHolder1_RadNumericTextBox3_wrapper" class="radInput_Default" style="display:inline;zoom:1;width:125px;">
47   <!-- 2.1.2 --><span id="ctl00_ContentPlaceHolder1_RadNumericTextBox3StyleSheetHolder" style="display:none;"></span><table cellpadding="0" cellspacing="0" style="border-width:0;border-collapse:collapse;table-layout:fixed;width:100%;">
48   <tr>
49   <td class="inputCell" style="width:100%;"><input type="text" id="ctl00_ContentPlaceHolder1_RadNumericTextBox3_text" class="radEnabledCss_Default" style="width:100%;" /><input style="visibility:hidden;position:absolute;right:0;width:0;height:0;overflow:hidden;border:0;padding:0;margin:0;" id="ctl00_ContentPlaceHolder1_RadNumericTextBox3" value="" type="text" /><input style="visibility:hidden;position:absolute;right:0;width:0;height:0;overflow:hidden;border:0;padding:0;margin:0;" id="ctl00_ContentPlaceHolder1_RadNumericTextBox3_Value" name="ctl00$ContentPlaceHolder1$RadNumericTextBox3" value="" type="text" /></td>
50   </tr>
51   </table><script type="text/javascript">window["ctl00_ContentPlaceHolder1_RadNumericTextBox3"] = new RadNumericTextBox("ctl00_ContentPlaceHolder1_RadNumericTextBox3", {"IncrementSettings":{"Step":1,"InterceptArrowKeys":true,"InterceptMouseWheel":true},"ShowSpinButtons":false,"MaxValue":70368744177664,"MinValue":-70368744177664,"SelectionOnFocus":3,"NumberFormat":{"DecimalSeparator":".","AllowRounding":true,"DecimalDigits":2,"GroupSizes":3,"GroupSeparator":",","NegativePattern":"-n","PositivePattern":"n","NegativeSign":"-"},"PostBackEventReferenceScript":"","AutoPostBack":false,"EmptyMessage":"","ClientEvents":{"OnError":"","OnButtonClick":"","OnLoad":"","OnMouseOut":"","OnMouseOver":"","OnFocus":"","OnBlur":"","OnDisable":"","OnEnable":"","OnValueChanged":"","OnKeyPress":"","OnEnumerationChanged":"","OnMoveUp":"","OnMoveDown":"","OnShowHint":""},"ShowButton":false,"ButtonsPosition":1,"Enabled":true}, {HoveredStyle: ["width:125px;", "radHoverCss_Default"],InvalidStyle: ["width:125px;", "radInvalidCss_Default"],DisabledStyle: ["width:125px;", "radDisabledCss_Default"],FocusedStyle: ["width:125px;", "radFocusedCss_Default"],EmptyMessageStyle: ["width:125px;", "radEmptyMessageCss_Default"],EnabledStyle: ["width:125px;", "radEnabledCss_Default"],NegativeStyle: ["width:125px;", "radNegativeCss_Default"]});window["ctl00_ContentPlaceHolder1_RadNumericTextBox3"].OriginalValue = '';</script>
52   </div>
53                   <div id="ctl00_ContentPlaceHolder1_RadNumericTextBox1_wrapper" class="radInput_Default" style="display:inline;zoom:1;width:125px;">
54   <!-- 2.1.2 --><span id="ctl00_ContentPlaceHolder1_RadNumericTextBox1StyleSheetHolder" style="display:none;"></span><table cellpadding="0" cellspacing="0" style="border-width:0;border-collapse:collapse;table-layout:fixed;width:100%;">
55   <tr>
56   <td class="inputCell" style="width:100%;"><input type="text" id="ctl00_ContentPlaceHolder1_RadNumericTextBox1_text" class="radEnabledCss_Default" onBlur="TestCalc()" style="width:100%;" /><input style="visibility:hidden;position:absolute;right:0;width:0;height:0;overflow:hidden;border:0;padding:0;margin:0;" id="ctl00_ContentPlaceHolder1_RadNumericTextBox1" value="" type="text" /><input style="visibility:hidden;position:absolute;right:0;width:0;height:0;overflow:hidden;border:0;padding:0;margin:0;" id="ctl00_ContentPlaceHolder1_RadNumericTextBox1_Value" name="ctl00$ContentPlaceHolder1$RadNumericTextBox1" value="" type="text" /></td>
57   </tr>
58   </table><script type="text/javascript">window["ctl00_ContentPlaceHolder1_RadNumericTextBox1"] = new RadNumericTextBox("ctl00_ContentPlaceHolder1_RadNumericTextBox1", {"IncrementSettings":{"Step":1,"InterceptArrowKeys":true,"InterceptMouseWheel":true},"ShowSpinButtons":false,"MaxValue":70368744177664,"MinValue":-70368744177664,"SelectionOnFocus":3,"NumberFormat":{"DecimalSeparator":".","AllowRounding":true,"DecimalDigits":2,"GroupSizes":3,"GroupSeparator":",","NegativePattern":"-n","PositivePattern":"n","NegativeSign":"-"},"PostBackEventReferenceScript":"","AutoPostBack":false,"EmptyMessage":"","ClientEvents":{"OnError":"","OnButtonClick":"","OnLoad":"","OnMouseOut":"","OnMouseOver":"","OnFocus":"","OnBlur":"","OnDisable":"","OnEnable":"","OnValueChanged":"","OnKeyPress":"","OnEnumerationChanged":"","OnMoveUp":"","OnMoveDown":"","OnShowHint":""},"ShowButton":false,"ButtonsPosition":1,"Enabled":true}, {HoveredStyle: ["width:125px;", "radHoverCss_Default"],InvalidStyle: ["width:125px;", "radInvalidCss_Default"],DisabledStyle: ["width:125px;", "radDisabledCss_Default"],FocusedStyle: ["width:125px;", "radFocusedCss_Default"],EmptyMessageStyle: ["width:125px;", "radEmptyMessageCss_Default"],EnabledStyle: ["width:125px;", "radEnabledCss_Default"],NegativeStyle: ["width:125px;", "radNegativeCss_Default"]});window["ctl00_ContentPlaceHolder1_RadNumericTextBox1"].OriginalValue = '';</script>
59   </div>
60                   <div id="ctl00_ContentPlaceHolder1_RadNumericTextBox4_wrapper" class="radInput_Default" style="display:inline;zoom:1;width:125px;">
61   <!-- 2.1.2 --><span id="ctl00_ContentPlaceHolder1_RadNumericTextBox4StyleSheetHolder" style="display:none;"></span><table cellpadding="0" cellspacing="0" style="border-width:0;border-collapse:collapse;table-layout:fixed;width:100%;">
62   <tr>
63   <td class="inputCell" style="width:100%;"><input type="text" id="ctl00_ContentPlaceHolder1_RadNumericTextBox4_text" class="radEnabledCss_Default" style="width:100%;" /><input style="visibility:hidden;position:absolute;right:0;width:0;height:0;overflow:hidden;border:0;padding:0;margin:0;" id="ctl00_ContentPlaceHolder1_RadNumericTextBox4" value="" type="text" /><input style="visibility:hidden;position:absolute;right:0;width:0;height:0;overflow:hidden;border:0;padding:0;margin:0;" id="ctl00_ContentPlaceHolder1_RadNumericTextBox4_Value" name="ctl00$ContentPlaceHolder1$RadNumericTextBox4" value="" type="text" /></td>
64   </tr>
65   </table><script type="text/javascript">window["ctl00_ContentPlaceHolder1_RadNumericTextBox4"] = new RadNumericTextBox("ctl00_ContentPlaceHolder1_RadNumericTextBox4", {"IncrementSettings":{"Step":1,"InterceptArrowKeys":true,"InterceptMouseWheel":true},"ShowSpinButtons":false,"MaxValue":70368744177664,"MinValue":-70368744177664,"SelectionOnFocus":3,"NumberFormat":{"DecimalSeparator":".","AllowRounding":true,"DecimalDigits":2,"GroupSizes":3,"GroupSeparator":",","NegativePattern":"-n","PositivePattern":"n","NegativeSign":"-"},"PostBackEventReferenceScript":"","AutoPostBack":false,"EmptyMessage":"","ClientEvents":{"OnError":"","OnButtonClick":"","OnLoad":"","OnMouseOut":"","OnMouseOver":"","OnFocus":"","OnBlur":"","OnDisable":"","OnEnable":"","OnValueChanged":"","OnKeyPress":"","OnEnumerationChanged":"","OnMoveUp":"","OnMoveDown":"","OnShowHint":""},"ShowButton":false,"ButtonsPosition":1,"Enabled":true}, {HoveredStyle: ["width:125px;", "radHoverCss_Default"],InvalidStyle: ["width:125px;", "radInvalidCss_Default"],DisabledStyle: ["width:125px;", "radDisabledCss_Default"],FocusedStyle: ["width:125px;", "radFocusedCss_Default"],EmptyMessageStyle: ["width:125px;", "radEmptyMessageCss_Default"],EnabledStyle: ["width:125px;", "radEnabledCss_Default"],NegativeStyle: ["width:125px;", "radNegativeCss_Default"]});window["ctl00_ContentPlaceHolder1_RadNumericTextBox4"].OriginalValue = '';</script>
66   </div>
67   </p>
68  
69       </div>
70      
71   <div>
72  
73   <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWBQLAub7zDQLV0LPBAQLV0J/mCALV0MecCgLV0IsLbY6WAvmYhIDqBdk2jgKBhXXyF2U=" />
74   </div></form>
75   </body>
76   </html>
77  

 
Big Red
Asp.Net User
Re: Set numeric textbox value in javascript1/15/2008 8:40:09 PM

0/0

oh wait, i get why there's nothing in the 2nd alert, because there's no value in that textbox.  So that's the one i really want to use.  Because if i would put say textbox3 instead of 4, then it gives me [object] for the first one and the correct value for the second alert.

 

Okay, another conclusion...  If I do this:

document.getElementById("<%= RadNumericTextBox4.ClientID %>").value = due;

alert(document.getElementById("<%= RadNumericTextBox4.ClientID %>").value);

 

the alert for this comes up correct.  So the value looks like it's being put into the correct textbox4, but it's not actually showing up in the web page.  any ideas why?

MorningZ
Asp.Net User
Re: Set numeric textbox value in javascript1/15/2008 9:13:27 PM

0/0

 it would be a question that is probably best for the Telerik forums, as that control is spitting out a bunch of garbly gook...  i mean look at that "RadNumericTextBox4"

<input type="text" id="ctl00_ContentPlaceHolder1_RadNumericTextBox4_text" class="radEnabledCss_Default" style="width:100%;" />
<input style="visibility:hidden;position:absolute;right:0;width:0;height:0;overflow:hidden;border:0;padding:0;margin:0;" id="ctl00_ContentPlaceHolder1_RadNumericTextBox4" value="" type="text" />
<input style="visibility:hidden;position:absolute;right:0;width:0;height:0;overflow:hidden;border:0;padding:0;margin:0;" id="ctl00_ContentPlaceHolder1_RadNumericTextBox4_Value" name="ctl00$ContentPlaceHolder1$RadNumericTextBox4" value="" type="text" />

 There's 3 actual textbox's for that......    if you switch to a normal <asp:TextBox> control, you'll have absolutely no problems

*maybe* you can say:
 
document.getElementById('ctl00_ContentPlaceHolder1_RadNumericTextBox4_text').value = due;

or

document.getElementById('ctl00_ContentPlaceHolder1_RadNumericTextBox4_Value').value = due; (<- this wouldn't make much sense since they sput it out as "visibility: hidden")

 

but that's just a total random guess at this point...  sorry i can't help further :( 


"If you make it idiot proof, they'll build a better idiot"
Big Red
Asp.Net User
Re: Set numeric textbox value in javascript1/15/2008 9:17:00 PM

0/0

Thanks for all the help.  I  really appreciate it.  I'll go to the Telerik forums and see if they can help me.  If I get an answer, I"ll post it here for future reference for anyone.  Thanks again!

15 Items, 1 Pages 1 |< << Go >> >|



Search This Site:





Other Resources:
Can not search multiple double-byte chatacters - macromedia.robohelp ... Can not search multiple double-byte chatacters, > ROOT > NEWSGROUP > Adobe-Macromedia ... set numeric textbox value in javascript. is option strict on or not? ...
value from 2 field joined in one field...( help designing form ... ... then I will have another textbox in form F2,let say TBD. ... it looks as if you are using the value of TBK to set the formatting for. TBD. Jeanette Cunningham " ...
VS.NET - ASP.NET - ASP.NET Numeric Textbox control - mredkj.com ... from the textbox control and adds a few properties to set parameters used for the javascript. ... Set(ByVal Value As Int32) _DecimalPlaces = Value End Set ...
Web Forms FAQ - TextBox ... to allow only numeric values in a textbox using ASP.NET Validator control? ... 32.10 How to get the textbox value at the client side ? <script lang="javascript" ...
dynamic addition of numeric values of textboxes in another textbox ... dynamic addition of numeric values of textboxes in another textbox javascript JavaScript ... should show in total textbox.if i decrease the value total should ...
Javascript Controls - The Spin Control A nice self-contained javascript spin control (or numeric up-down) component. ... own methods to calculate the highest or lowest value to display in the textbox. ...
Build a Textbox for Numeric Input LANGUAGES: JavaScript. ASP.NET VERSIONS: 1.0 | 1.1. Build a Textbox for Numeric Input ... to ensure that non-numeric text is discarded if set programmatically. ...
Numeric validation In JAVA Script How do we validate numeric validations in JAVA script. ... If I add value in textbox, it should compare and throw msg if it enters other. than 0123456789. ...
 
All Times Are GMT