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

Disabling RadGrid refresh after AJAX request

1 Answer 109 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Zdeněk
Top achievements
Rank 1
Zdeněk asked on 16 Jul 2010, 11:53 AM
Hi,
I have RadNumericTextBox in teplate field of RadGrid. There are many rows=many texboxes. Users will fill some number in numeric textbox and by pressing Tab I want to:
- save edited value from radnumerictextbox to database through AJAX call
- move to another row (=next RadNumericTextbox), edit value, press Tab etc...

I set for each RadNumericTextBox OnValueChanged client side event.  But after AJAX call radgrid refresh itself and RadNumericTextbox looses focus.  RadGrid is not  AJAXified. What do I have wrong? Thank you.

<telerik:RadNumericTextBox  ID="txtCounterValue" runat="server"  Width="80"
                                            MinValue="0" NumberFormat-AllowRounding="false" NumberFormat-DecimalDigits="0"
                                            EnabledStyle-HorizontalAlign="Right" EnabledStyle-Font-Bold="true"
                                            >
                                            <ClientEvents OnValueChanged="CounterValueChanged" />
                                        </telerik:RadNumericTextBox>

and javascript:
function CounterValueChanged(sender, args) {
                var allOK = true;
                var oldValue = args.get_oldValue();
                var newValue = args.get_newValue();
$find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequest('UpdateCounter')
      
           }

1 Answer, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 20 Jul 2010, 03:02 PM
Hello Zdenek,

You do need the grid to refresh in order to keep it in synchrony with its underlying datasource - as RadGrid is a data-bound control. However, one possible solution is to refocus the textbox on each ajax request - for that purpose you can use the ScriptManager's SetFocus(Control controlToFocus) method in the PreRender event of the page.

Hope it helps.

Regards,
Tsvetoslav
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Zdeněk
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Share this question
or