In an ajaxified RadGrid, I want two buttons to cause a post back (bypass Ajax) and execute some back-end code. Here's what I have so far...
Buttons (just showing one for simplicity):
Javascript function I'm using to disable the postback:
Code-behind I want to execute:
So the post back does indeed occur, but my code never fires. I'm guessing it's because the event is tied to the grid and not to buttons im "un-ajaxifying", but I went this way because I NEED to capture the values of some of the cells in the row that the button was clicked.
Maybe I can rework this to use the buttons onClick Event, but I would still need to capture those values.
Can anyone help?
Buttons (just showing one for simplicity):
<telerik:GridTemplateColumn HeaderText="Actions"> <ItemTemplate> <asp:ImageButton ID="btnEdit" runat="server" OnClientClick="realPostBack();" ImageUrl="~/images/icon_edit.png" style="display: inline-block" ToolTip="Edit" CommandName="fbEdit" /> </ItemTemplate></telerik:GridTemplateColumn>Javascript function I'm using to disable the postback:
<script type="text/javascript"> function realPostBack(eventTarget, eventArgument) { $find("<%= RadAjaxPanel1.ClientID %>").__doPostBack(eventTarget, eventArgument); }</script>Code-behind I want to execute:
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e) { if (e.CommandName == "fbEdit") { //grab variables from row's cells string userID = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["UserID"]; string userName= e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["UserName"]; string userEmail = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["UserEmail"]; //DO SOME PROCESSING STUFF } if(e.CommandName == "fbDelete") { //delete record } }So the post back does indeed occur, but my code never fires. I'm guessing it's because the event is tied to the grid and not to buttons im "un-ajaxifying", but I went this way because I NEED to capture the values of some of the cells in the row that the button was clicked.
Maybe I can rework this to use the buttons onClick Event, but I would still need to capture those values.
Can anyone help?