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

Get Column values client side for inserted row

1 Answer 53 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tracy
Top achievements
Rank 1
Tracy asked on 08 Jul 2012, 12:38 AM
Hi,

I am trying to validate the columns in an inserted row client side and can't figure out how to get a reference to the individual columns in the inserted row.

I have tried the function listed below but it returns 'undefined'

   function SaveNew(sender, eventArgs) {
        var masterTable = $find("<%= rgvMainGrid.ClientID %>").get_masterTableView();
        //gets the HTML object of the insert item opened in the current GridTableView
        var insertedItem = masterTable.get_insertItem();
        alert(insertedItem[1]);

    }


I have seen an example where the javascript is added in the code behind and the column values are sent to the client but there are about 20 columns I want to validate and just want to be able to create the script on the page.

Any assistance would be appreciated.
Thank You

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 09 Jul 2012, 05:10 AM
Hi Tracy,

Try the following javascript to get column values in client side for inserted row.

ASPX:
<ClientSettings>
    <ClientEvents OnCommand="OnCommand" />
</ClientSettings>

Javascript:
<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);
            alert($telerik.$(".rgEditForm", sender.get_masterTableView().get_element())[0].getElementsByTagName("Input")[1].value);
        }
    }
</script>

Thanks,
Shinu.
Tags
Grid
Asked by
Tracy
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or