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

Getting OnRowSelect to perform postback using JQuery

1 Answer 55 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
John
Top achievements
Rank 1
John asked on 09 Nov 2010, 06:14 PM
Hi, im trying to make it so that when i select an element on the grid, an html.hidden value is set to the selected row's value, and then i want the form to be submitted so that some elements on the screen are saved and others are updated. Im not sure if this is a telerik problem or a jquery problem. This is what i have for the telerik grid:


            <% Html.Telerik().Grid<WasteStreamGenerator>("GeneratedWaste")
                   .Name("GeneratedWasteGrid")
                   .DataKeys(keys => keys.Add(c => c.Id))
                   .Columns(columns =>
                                {
                                    columns.Bound(t => t.Id).Visible(false);
                                    columns.Bound(t => t.WasteType.IsNos).Title("N/D");
                                    columns.Bound(t => t.WasteType.ShippingName).Title("Shipping Name");
                                    columns.Bound(t => t.WasteType.WasteCode.WasteCodeCode).Title("Waste Code");
                                    columns.Bound(t => t.WasteType.Pin).Title("TDGA/PIN");
                                    columns.Bound(t => t.WasteType.Class).Title("Class");
                                    columns.Bound(t => t.PackingGroup.PackingGroupCode).Title("Packing Group");
                                    columns.Bound(t => t.HandlingCode.Id).Title("Handling Code");
                                    columns.Bound(t => t.SourceQuantity).Title("Quantity");
                                    columns.Bound(t => t.Unit.UnitCode).Title("Unit");
                                })
                   .ClientEvents(events => events.OnRowSelect("onRowSelect"))
                   .Selectable()
                   .Render();

and this is my onRowSelect function:

        function onRowSelect(e) {
            var row = e.row;
            $('#postId').val('-1');
            $("#mainform").submit();
        }

Now the function is being called, and when i use firebug to trace it, it goes through all of the elements, but the post doesnt happen. Is there anything that i can do to get this behaviour?

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 10 Nov 2010, 08:17 AM
Hi John,

 I am not sure that the submit() jQuery function will actually submit the form. You can calling the DOM submit method instead:

$("#mainform")[0].submit();


Regards,
Atanas Korchev
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
John
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or