This is a migrated thread and some comments may be shown as answers.

[Solved] How to find a RadNumericTextBox that resides in a FormView

2 Answers 141 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Kem Arda
Top achievements
Rank 1
Kem Arda asked on 12 Oct 2009, 08:08 AM
I just wantto find a RadNumericTextBox that resides in a FormView as follows:

function

kontrol() {

 

alert(

"asd")

 

 

 

var txtmiktar = window["<%= RadNumericTextBox2.ClientID %>"];

 

 

var txtyuzde = window["<%= RadNumericTextBox1.ClientID %>"];

 

 

if (txtmiktar.GetValue() == '') {

 

txtmiktar.SetValue(0.00) ;

}

 

if (txtyuzde.GetValue() == '') {

 

txtyuzde.SetValue(0.00) ;

}

 

if (txtyuzde.GetValue() == 0 && txtmiktar.GetValue() == 0) {

 

alert('

asd');

 

 

}

}

And i call it this way: However it throws exception : cs0103 'RadNumericTextBox2'  does not exist in the current context

 

<

telerik:RadNumericTextBox ID="RadNumericTextBox2" Runat="server"

 

 

Culture="asd" DbValue='<%# Bind("asd") %>' Type="Currency"

 

 

Width="125px" CssClass="label2" MaxValue="1E+16" MinValue="-1E+16" >

 

 

 

 

 

<ClientEvents OnKeyPress="kontrol" />

 

 

</telerik:RadNumericTextBox>

Thanks...

 

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 12 Oct 2009, 08:28 AM
Hi Kem Arda,

Since you are using RadControls for ASP.NET AJAX version, you could use $find method for getting the clientside object.

And OnKeyPress event includes two parameters sender and eventArgs (sender is the input control which invokes the event).

JavaScript:
 
<script type="text/javascript"
    function kontrol(sender, eventArgs) { 
        var txtmiktar = sender; // Represents the RadComboBox client object 
    } 
</script> 

-Shinu.
0
Kem Arda
Top achievements
Rank 1
answered on 12 Oct 2009, 09:18 AM
Ah, i see, Thanks. Then, how am i supposed to get/set values of RadNumericTextBox?
Tags
General Discussions
Asked by
Kem Arda
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Kem Arda
Top achievements
Rank 1
Share this question
or