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

[Solved] Client Side Window Creation, Ajax Form, Post, and reload content.

0 Answers 150 Views
Window
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Bob Mills
Top achievements
Rank 2
Bob Mills asked on 26 Jan 2011, 04:49 PM
Hello,

I had a pretty specific issue with the MVC Window, and I think I've solved it in the best way possible, but I wanted to ask the experts.

Our application has a Telerik grid, with an edit link, that uses javascript and jquery to create and show a Telerik Window, where the user will perform the editing functions and save.  Any validation is done on the server side at the moment, so the content area (loaded by Ajax) will need to be refreshed after the Ajax Form Post.

Here is the Javascript function to create the window:
function editGLRecurringTransaction(glRecurId) {
    var windowElement = $.telerik.window.create({
        title: "Edit Recurring Transaction",
        contentUrl: '/GL/EditRecurringTransaction?Id=' + glRecurId,
        modal: true,
        resizable: false,
        draggable: true,
        width: 450,
        height: 300,
        onClose: function () { },
        onRefresh: function () {
            jQuery(this).data('tWindow').center();
        }
    });
 
    var window = jQuery(windowElement).data('tWindow');
    var contentDiv = jQuery('.t-window-content', windowElement)
 
    jQuery(contentDiv).attr('id', 'tWindEditGLRecur_' + glRecurId);
 
    window.refresh();
    window.center();
    window.open();
}

So essentially, all that happens here is that the Telerik Window gets created and immediately, the content area div is located and given an id.  The reason for the is so that the Ajax Form Code can have it's TargetUpdateId Property set to "tWindowEditGLRecur_" & Model.id. 

My question is:  Is this the best way to go about doing this?

And as a followup question if the answer involves more specialized code:  Can we get a couple parameters on the Window constructor to set Html Attributes in the same way we can do so Server side?

Thanks for your help.
Tags
Window
Asked by
Bob Mills
Top achievements
Rank 2
Share this question
or