Custom AJAX call with Radgrid and Radwindow

4 posts, 0 answers
  1. Freddy
    Freddy avatar
    3 posts
    Member since:
    Jun 2013

    Posted 15 Jul 2013 Link to this post

    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
  2. Angel Petrov
    Admin
    Angel Petrov avatar
    1006 posts

    Posted 18 Jul 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Freddy
    Freddy avatar
    3 posts
    Member since:
    Jun 2013

    Posted 18 Jul 2013 Link to this post

    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>
  5. Angel Petrov
    Admin
    Angel Petrov avatar
    1006 posts

    Posted 23 Jul 2013 Link to this post

    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.
Back to Top