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

[Solved] RadGrid row events

2 Answers 131 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 1
Jon asked on 04 Nov 2009, 08:06 PM
Hi,

Using the ajaxManager.ajaxRequest method within javascript, is there any way to pass to the server details of the current GridEditFormItem that is the container for the control triggering the postback? 

For example one of the sequences of logic requires that if a date in a RadDateTimePicker changes, a routine will pass that date, another date from a further datetimepicker, a reference to an image control and a reference to a combo box to the server.  On the server the information from the two dates and the combo box will then determine what image is displayed in the image control.

Now the simplest way of managing this is to grab the GridEditFormItem and get the server to act on that, then I can easily reference it's controls using the FindControl methods.

Been on this page all day and have made great progress but am hitting a brick wall now I'm on the final stage :(

Any help would be greatly appreciated.

Best Regards,

Jon

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 05 Nov 2009, 10:17 AM
Hi,

I have triggered an ajax request  on clicking a button in the edit form and passed the edit index as an argument. In the server event  you can access the GridEditFormItem using the edit index.

JS:
 function ButtonClicked(button) 
    { 
     var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");      
     var editIndex= $find("RadGrid1")._editIndexes ; 
     ajaxManager.ajaxRequest(editIndex); 
     return false
    } 

C#
protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e) 
    { 
        GridEditFormItem editItem = (GridEditFormItem)RadGrid1.MasterTableView.GetItems(GridItemType.EditFormItem)[Convert.ToInt32(e.Argument)]; 
    } 

Thanks,
Princy



0
Jon
Top achievements
Rank 1
answered on 05 Nov 2009, 10:34 AM
Hi Princy,

Thanks for that - slight issue though as I've got all edit forms active at once so the editIndex ends up being an array such as 0,1,2,3 if there are 4 rows :( 

I'll have a look to see if I can get that index from a control object that I have within the active row.  Maybe I can get it's parent and up till I get the index value.

Many thanks,

Jon
Tags
Grid
Asked by
Jon
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Jon
Top achievements
Rank 1
Share this question
or