Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is it possible to translate this into javascript
Message
 
 
To
All
General information
Forum:
ASP.NET
Category:
MVC
Title:
Is it possible to translate this into javascript
Environment versions
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01561782
Message ID:
01561782
Views:
60
Hi everybody,

I found a good link showing how to use modal dialogs in ASP.NET MVC application

http://www.matthidinger.com/archive/2011/02/22/Progressive-enhancement-tutorial-with-ASP-NET-MVC-3-and-jQuery.aspx

For my purpose I am using buttons and I need to associate action with buttons in run-time using JavaScript.

In his code he is using the following:
@Html.ActionLink("Contact Us", "ContactUs", "Home", null, new{ @class = "openDialog", data_dialog_id = "emailDialog", data_dialog_title = "Contact Us"})
I am wondering if there is a way to somehow do the same but using JavaScript?

This is what I have right now but this is not working and not even opening a dialog:
var $dlg = $("editor").dialog({
    autoOpen: false,
    show: "blind",
    closeOnEscape: true,
    resizable: true,
    width: 1200,
    height: 750,
    minHeight: 600,
    minWidth: 950
});

function RunModalDialog(title, url)
{    
    if (title)
        $dlg.dialog("option", {"title": title });

    if (url)
    {        
        $dlg.load(url).dialog("option", { "title": title }).dialog("open");
    }
        //$dlg.load(url, function () {
        //    var validator = $("#sform").validate();
        //    if (validator)
        //         validator.resetForm();
        //    $dlg.dialog("option", { "title": title }).dialog("open");
        //});
    else {
        var validator = $("#sform").validate();
        if (validator)
            validator.resetForm();
        $dlg.dialog("open");
    }
}
and in the main page I have right now
<div id="editor" style ="visibility :hidden ">
    
</div>
Do you see how can I translate the ActionLink into JavaScript?
If it's not broken, fix it until it is.


My Blog
Next
Reply
Map
View

Click here to load this message in the networking platform