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

RadGrid RowDblClick button click via javascript

1 Answer 177 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Scruff343
Top achievements
Rank 1
Scruff343 asked on 18 Jan 2015, 09:15 AM
Hi all, I am trying to set up my grid so when a person double clicks on a row it fires a code behind click event that I have for a button within the CommandItemTemplate but I can't seem to manage it. Below is what code I think will be relevant, any help will be greatly appreciated.

Thanks.

As you can see I have the client event;

<ClientEvents OnRowDblClick="RowDblClick" />

Which triggers;

function RowDblClick(sender, eventArgs) {           document.getElementById('<%= editJourneyButton.ClientID %>').click();      }

The button is within the CommandItemTemplate;

<asp:LinkButton ID="editJourneyButton" OnClick="editJourneyButton_Click" runat="server" CssClass="btn btn-inverse" Text="Edit selected"><i class="fa fa-edit"></i> Edit Selected</asp:LinkButton>
 

The click event for this button is;

 protected void editJourneyButton_Click(object sender, EventArgs e)<br>        {<br><br>            ErrorList.Items.Clear();<br><br>            if (journeysGrid.SelectedItems.Count == 0)<br>            {<br>                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "noItemSelected", "noItemSelected();", true);<br>            }<br>            else<br>            {<br>                GridDataItem selectedItem = (GridDataItem)journeysGrid.SelectedItems[0];<br>                TravelFormUC.resetForm();<br>                TravelFormUC.refHiddenField.Value = selectedItem.GetDataKeyValue("journeyId").ToString();<br>                TravelFormUC.setupForm();<br>                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "showClaimPopup", "showClaimPopup();", true);<br>            }

This ScriptManager code for "showClaimPopup" is;
 
function showClaimPopup() {<br>            $('#modal-claimform').modal('show')<br>        }


This probably isn't the best way to go about what I am trying to achieve so any advice or guidance would be great.

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 22 Jan 2015, 12:00 PM

Hello,

You can initiate a server-side command using the following method and then handle the custom logic during the ItemCommand event handler:
http://www.telerik.com/help/aspnet-ajax/grid-gridtableview-firecommand.html

If you decide to continue with your initial logic, you can access the editJourneyButton using the findElement method:
http://www.telerik.com/forums/javascript-on-each-item#FpwQalBeNkGNGYJoZBJYhg

Hope this helps.

Regards,

Eyup
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Scruff343
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or