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

Custom AJAX call with Radgrid and Radwindow

3 Answers 81 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Freddy
Top achievements
Rank 1
Freddy asked on 15 Jul 2013, 04:27 PM
I'm using a Radgrid with a NestedViewTemplate that has a user control inside of it. This user control has a button that opens up a radwindow to view more details. What I'd like to do is add a record to the database that somebody clicked on the button to view the radwindow. so it would require calling a custom Method in the codebehind for this puspose. Any direction would be great

3 Answers, 1 is accepted

Sort by
0
Angel Petrov
Telerik team
answered on 18 Jul 2013, 01:56 PM
Hi Freddy,

I have already replied in the official support ticket which you have opened regarding this matter. In order to help other community members to overcome this issue I am posting my reply here:

"The functionality mentioned is achievable by ajaxifying the RadGrid and subscribing to the client OnResponseEnd event of the RadAjax which will be used for opening the RadWindow. The idea is to intercept the server-side OnClick event of the button and execute the logic for saving the information in the database there. Once the response from the server comes back you can check which control initiated the postback and if it is the button open the RadWindow. A sample demonstration of this can be reviewed in the attached website."

Regards,
Angel Petrov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Freddy
Top achievements
Rank 1
answered on 18 Jul 2013, 02:23 PM
Here's another question though. that button in your nestedviewtemplate is actually INSIDE a Control that's inside that NestedViewTemplate likte this

<NestedViewTemplate>
            <jod:JobOrderDetail runat="server" ID="ucJobDetails" JobOrderId='<%# Eval("JobOrderId") %>' />
</NestedViewTemplate>
0
Angel Petrov
Telerik team
answered on 23 Jul 2013, 01:02 PM
Hi Freddy,

As I explained in the official support ticket placing the button in a user control does not change the scenario. The only difference is how the grid items are accessed in the button click event handler. For example a reference to the GridDataItem related to the NestedViewTemplate in which the user control is placed can be obtained like demonstrated below:
protected void RadButton1_Click(object sender, EventArgs e)
   {
       GridDataItem item = (((sender as RadButton).NamingContainer as Control).NamingContainer as GridNestedViewItem).ParentItem as GridDataItem;
   }

Regards,
Angel Petrov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Ajax
Asked by
Freddy
Top achievements
Rank 1
Answers by
Angel Petrov
Telerik team
Freddy
Top achievements
Rank 1
Share this question
or