Closing RadWindow Breaks RadGrid Cancel Button

4 posts, 0 answers
  1. pmourfield
    pmourfield avatar
    32 posts
    Member since:
    Aug 2011

    Posted 03 May 2012 Link to this post

    Good afternoon. I am currently experiencing a problem. I am using the RadWindow as a dialog and allowing the user to fill out information on the dialog. When the dialog is closed, I am retrieving the values from the dialog (using the exact same technique described here:http://demos.telerik.com/aspnet-ajax/window/examples/dialogreturnvalue/defaultcs.aspx)  and setting them as values on the parent browser window. The textboxes that I am populating are inside of a RadGrid. They populate just fine but if I click the Cancel button after populating them, I get the following error:

    'Sys.WebForms.PageRequestManagerServerErrorException: Sys.WebForms.PageRequestManagerServerErrorException: Invalid JSON primitive: Setup.' when calling method: [nsIDOMEventListener::handleEvent]

    Any help would be appreciated.

  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    5709 posts

    Posted 04 May 2012 Link to this post

    Hi Joshua,

    What happens if you simply modify these textboxes directly from the main page, without using the RadWindow at all? Also, is the RadWindow performing an AJAX request when it is closed? I am asking this because it is possible that two requests are initiated with different values. I would advise that you attach a breakpoint to your server code and step through to determine the exact line that is throwing the server error so that you can see where the problematic data originates from. It is possible that the values you pass from the dialog are not serialized properly to create a valid JSON object and thus throw a server error in the request. One of the easiest ways to debug such a problem is to temporarily disable AJAX and run the page in debug mode (with F5). If the error message does not come from your code but from our assembly, to fix it we will need to replicate the issue locally. Therefore I would ask you send us either a runnable project illustrating it, or at least the page and the user control so we try mimic your scenario in a local web site and perform further investigation.


    Kind regards,
    Marin
    the Telerik team
    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 their blog feed now.
  3. pmourfield
    pmourfield avatar
    32 posts
    Member since:
    Aug 2011

    Posted 04 May 2012 Link to this post

    I am not sure what exactly what was going on but I boiled it down to jquery trying to populate some RadNumericTextBox controls. When it tried to populate them it was only able to populate the value of the control but the text did not actually show up in the control. I had to use Firebug to see if the value was being assigned, which it was...it just wasn't visible in the control.

    I ended up getting around the problem by populating some hidden fields at the bottom of the markup page, calling a button click and subsequently populating the appropriate fields after postback.

    I'm thinking that the values were being assigned to the hidden span contained in the radnumerictextbox but weren't being assigned to the actual textbox that it contains...I didn't want to mess around with it too much because the javascript started getting bloated so I opted for the code-behind solution.

    Thank you for your reply!

    Respectfully,

    Joshua
  4. Marin Bratanov
    Admin
    Marin Bratanov avatar
    5709 posts

    Posted 04 May 2012 Link to this post

    Hello Joshua,

    I am glad to hear you have got things working, yet I'd like to follow up a bit on this issue. The RadControls for ASP.NET AJAX create client-side objects and are not pure HTML, so using jQuery to populate their values is not the correct way to do this. You need to use the client-side API of the control after you get a reference to it via the $find() method. The way to do this for the RadNumericTextbox is explained here, and this is a small example:
    var numericBox = $find("<%= RadNumericTextBox1.ClientID %>");
    numericBox.set_value(100);



    Greetings,
    Marin
    the Telerik team
    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 their blog feed now.
Back to Top