Hi,
The topic is a bit simplistic tbh, so i'll exlpain more in detail.
I have a RadGrid defined as follows:
I also have a formview in the page right under the Radgrid. When I click on a row in the radgrid, I retrieve the necessary information and then use it to load the complete data of my row in the formview.
I do this by catching the "RowClick" command in the ItemCommand event on the server.
In addition, the formview data can become modifiable if I click on an "Edit" button that I have on my page.
When I'm editing the data, if the user clicks on another row of the grid, I need to provide the user with a warning using RadConfirm to warn him/her that the data they entered will be lost.
I implemented that functionality for Menu items on the page, as well as for RadButtons on the page (where necessary), but I am having trouble implementing this for the grid.
Here's the javascript code for the client methods:
For clarification:
The ConfirmExit variables are set in the code behind when I go into edit mode. It's a variable used to detect if i need to display the confirm box or not.
I'm having 2 issues with the above code:
In the RowSelecting method, eventArgs.set_cancel(true) does nothing. The command is fired still and the code behind is executed. I have a feeling this is normal because the event is firing anyways, correct?
This caused me to try and implement the RowCommand method. My problem with that one is that the client-side event never seems to be fired, even when I disable the RowSelecting and RowSelected events.
I hope this was clear enough...
Any ideas?
Thank you.
The topic is a bit simplistic tbh, so i'll exlpain more in detail.
I have a RadGrid defined as follows:
<telerik:RadGrid ID="CovenantRadGrid" runat="server" AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True" CellSpacing="0" DataSourceID="ProjectCovenantListingDataSource" GridLines="None" Skin="Office2007" ClientSettings-EnablePostBackOnRowClick="true" OnPreRender="CovenantRadGrid_PreRender" OnItemCommand="CovenantRadGrid_ItemCommand" AllowAutomaticDeletes="true" OnItemDeleted="CovenantRadGrid_ItemDeleted" OnItemDataBound="CovenantRadGrid_ItemDataBound"> <GroupingSettings CaseSensitive="false" /> <ClientSettings EnableRowHoverStyle="true"> <Selecting AllowRowSelect="True" /> <ClientEvents OnRowClicking="OnRowClicking" OnRowClicked="OnRowClicked" OnCommand="OnRowCommand" /> </ClientSettings>.....I also have a formview in the page right under the Radgrid. When I click on a row in the radgrid, I retrieve the necessary information and then use it to load the complete data of my row in the formview.
I do this by catching the "RowClick" command in the ItemCommand event on the server.
In addition, the formview data can become modifiable if I click on an "Edit" button that I have on my page.
When I'm editing the data, if the user clicks on another row of the grid, I need to provide the user with a warning using RadConfirm to warn him/her that the data they entered will be lost.
I implemented that functionality for Menu items on the page, as well as for RadButtons on the page (where necessary), but I am having trouble implementing this for the grid.
Here's the javascript code for the client methods:
var isRowSelected = "false"; function OnRowSelecting(sender, eventArgs) { try { var confirmExit = confirmExitKey; if (confirmExit == "True") { if (isRowSelected == "false") { eventArgs.set_cancel(true); var row = sender; function CallBackFn(arg) { if (arg) { isRowSelected = "true"; row.select(); } } radconfirm('<%= GetGlobalResourceObject("GlobalResources", "E009") %> \n\n<br><br>', CallBackFn, 350, 120, null, 'Discard Changes?'); } } } catch (ex) { } } function OnRowSelected(sender, eventArgs) { //reset the isAddButtonClicked variable isRowSelected = "false"; } var isRowCommandFired = "false"; function OnRowCommand(sender, eventArgs) { try { var itemIndex = itemIndex = eventArgs.get_commandArgument(); if (eventArgs.get_commandName() == "RowClick") { var confirmExit = confirmExitKey; if (confirmExit == "True") { if (isRowCommandFired == "false") { eventArgs.set_cancel(true); var row = sender; function CallBackFn(arg) { if (arg) { isRowCommandFired = "true"; var masterTable = $find("<%= CovenantRadGrid.ClientID %>").get_masterTableView(); masterTable.fireCommand("RowClick", itemIndex); isRowCommandFired = "false"; } } radconfirm('<%= GetGlobalResourceObject("GlobalResources", "E009") %> \n\n<br><br>', CallBackFn, 350, 120, null, 'Discard Changes?'); } } } } catch (ex) { } }For clarification:
The ConfirmExit variables are set in the code behind when I go into edit mode. It's a variable used to detect if i need to display the confirm box or not.
I'm having 2 issues with the above code:
In the RowSelecting method, eventArgs.set_cancel(true) does nothing. The command is fired still and the code behind is executed. I have a feeling this is normal because the event is firing anyways, correct?
This caused me to try and implement the RowCommand method. My problem with that one is that the client-side event never seems to be fired, even when I disable the RowSelecting and RowSelected events.
I hope this was clear enough...
Any ideas?
Thank you.