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

Getting the new data row in client side

8 Answers 252 Views
Grid
This is a migrated thread and some comments may be shown as answers.
rachel
Top achievements
Rank 1
rachel asked on 15 Dec 2010, 06:40 PM
hi.
i'm using with tableView.get_dataItems() for getting the current editind item in "OnCommand" client-event;
its working good, but get_dataItems()  not contains the new record  in case of insert.
How could i getting the current new values in client?

thanks

8 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 16 Dec 2010, 08:26 AM
Hello Rachel,

Give a try with the following approach to get the insert form cell value from client side.

Java Script:
<script type="text/javascript">
    function OnCommand(sender, args) {
       if (args.get_commandName() == "PerformInsert") {
            alert($telerik.$(".rgEditForm", sender.get_masterTableView().get_element())[0].getElementsByTagName("input")[0].value); // first insert form cell value
            alert($telerik.$(".rgEditForm", sender.get_masterTableView().get_element())[0].getElementsByTagName("input")[1].value); // second insert form cell value
        }
    }
</script>

Also refer the following code library  which provides an example of how to retrieve editor values on client:
Retrieving grid editor value client side

Thanks,
Princy.
0
rachel
Top achievements
Rank 1
answered on 21 Dec 2010, 11:47 AM

hello,
its not good for me.
i'm using with EditMode="InPlace" and not "EditForms".
i have tried to set the ItemCreated event, but e.Item Is NOT GridEditFormItem.
What could i do??

 

0
Princy
Top achievements
Rank 2
answered on 21 Dec 2010, 12:05 PM
Hello Rachel,

If you are using InPlace EditMode, use .rgEditRow instead of .rgEditForm.

Java script:
<script type="text/javascript">
    function OnCommand(sender, args) {
       if (args.get_commandName() == "PerformInsert") {
            alert($telerik.$(".rgEditRow", sender.get_masterTableView().get_element())[0].getElementsByTagName("input")[0].value); // first insert form cell value
            alert($telerik.$(".rgEditRow", sender.get_masterTableView().get_element())[0].getElementsByTagName("input")[1].value); // second insert form cell value
        }
    }
</script>

Thanks,
Princy.
0
rachel
Top achievements
Rank 1
answered on 21 Dec 2010, 01:18 PM
Thank you so much, now its works perfectly.
0
miri
Top achievements
Rank 1
answered on 31 Jan 2011, 11:07 AM
I also have a grid using InPlace EditMode and I used this code
$telerik.$(".rgEditRow", sender.get_masterTableView().get_element())[0].getElementsByTagName("input")[0].value
but when I add scroll to the grid
the $telerik.$(".rgEditRow", sender.get_masterTableView().get_element())[0] was undefined
what is the problem?
0
Princy
Top achievements
Rank 2
answered on 02 Feb 2011, 12:37 PM
Hello Miri,

I also faced the similar issue when enabling scrolling in RadGrid. You can try the approach mentioned in the following code library  to retrieve editor values on client:
Retrieving grid editor value client side

Thanks,
Princy.
0
Ceki Granti
Top achievements
Rank 1
answered on 22 Sep 2012, 06:12 AM
Hi Princy,

I know this is an old post but I'm facing the same issue. The problem is, how can I get the value of readonly GridNumericTextBox from the insert row? (EditMode=InPlace, scrolling is enabled) It seems to be rendering like <td>UnitPrice</td>

Kind regards
Ceki
0
Eyup
Telerik team
answered on 26 Sep 2012, 12:11 PM
Hi Ceki,

Are you using a GridNumericColumn with its ReadOnly property set to true?
In such a case, could please try the following approach?
<ClientEvents OnCommand="gridCommand" />
  JavaScript:
function gridCommand(sender, args) {
    if (args.get_commandName() == "Update") {
        var value = sender.get_masterTableView().get_dataItems()     
        [args.get_commandArgument()].get_cell("Freight").textContent;
    }
}

If you have different requirements or further instructions, please elaborate some more on your specific scenario.

Regards,
Eyup
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
rachel
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
rachel
Top achievements
Rank 1
miri
Top achievements
Rank 1
Ceki Granti
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or