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

RadGrid + GridTemplateColumn + RadNumericTextBox

4 Answers 150 Views
Input
This is a migrated thread and some comments may be shown as answers.
Eric
Top achievements
Rank 2
Eric asked on 21 Jan 2011, 09:23 PM
Hi all,

I'm having trouble trying to get the client event "ValueChanged" of the RadNumericTextBox to fire when AllowOutOfRangeAutoCorrect is set to false. I have my RadNumericTextBox inside a GridTemplateColumn from the RadGrid. The JS function is never called.

Here's how my code looks like:

<telerik:GridTemplateColumn HeaderText="Qty" DataField="Quantity" UniqueName="Quantity">
                <ItemTemplate>
                    <telerik:RadNumericTextBox ID="quantity" runat="server"
                        DataType="System.Int32"     
                        AllowOutOfRangeAutoCorrect="false"                
                        MinValue='<%# Decimal.Parse(Eval("MinimumQuantity").ToString()) %>'
                        DbValue='<%# Convert.ToInt32(Eval("Quantity")) %>'
                        Type="Number"
                        SelectionOnFocus="SelectAll"
                        NumberFormat-DecimalDigits="0">
                        <ClientEvents OnValueChanged="OnClientValueChanged" />
                    </telerik:RadNumericTextBox>
                </ItemTemplate>
            </telerik:GridTemplateColumn>

<script type="text/javascript">
        function OnClientValueChanged(sender, args)
        {
             alert("hello");
         //do something
        }
</script>

Thanks in advance!

Eric

4 Answers, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 26 Jan 2011, 03:46 PM
Hi Eric,

I tried to replicate the described issue but to no avail. I ran the page attached to this message with the latest version of RadControls and the value changed event fires as expected when the textboxes lose focus after their values are modified.

Please, take a look at the attached page and try to modify it until it starts replicating the problemmatic behavior. Then post the modifications that you made and we will inspect it locally.

All the best,
Tsvetina
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Eric
Top achievements
Rank 2
answered on 27 Jan 2011, 10:15 PM
Actually, I beleive I found out what the problem is, but I don't know how to solve it. If we take your example (Default.aspx), valueChanged will only be fired when the value entered is greater or equal to the RadNumericTextBox's MinValue. When it is less than the MinValue, valueChanged is not fired.

That being said, how can I make this work even when the value entered is less than the MinValue?

Thx,
Eric
0
Accepted
Tsvetina
Telerik team
answered on 01 Feb 2011, 01:14 PM
Hello Eric,

It is expected that the event is not fired because the value is indeed unchanged. You can instead wire the OnValueChanging event which is fired before the new value is validated and eventually rejected.

Best wishes,
Tsvetina
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Eric
Top achievements
Rank 2
answered on 02 Feb 2011, 12:59 AM
OnValueChanging worked. Didn't know we could access the new and old value in this event. Should have look into it though...

Thanks again Tsvetina!
Tags
Input
Asked by
Eric
Top achievements
Rank 2
Answers by
Tsvetina
Telerik team
Eric
Top achievements
Rank 2
Share this question
or