Click here to Skip to main content
14,930,671 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Cross site scripting poor validation for asp.net labels Pin
Richard Deeming16-Aug-17 10:11
mveRichard Deeming16-Aug-17 10:11 
AnswerRe: Cross site scripting poor validation for asp.net labels Pin
viprat18-May-20 23:10
Memberviprat18-May-20 23:10 
QuestionMaintaining sessions in Web Applications with Web Api Pin
indian14310-Aug-17 8:32
Memberindian14310-Aug-17 8:32 
AnswerRe: Maintaining sessions in Web Applications with Web Api Pin
F-ES Sitecore10-Aug-17 22:14
mveF-ES Sitecore10-Aug-17 22:14 
QuestionWebsite down frequently in windows server 2008 standard IIS 7 Pin
ramesh1080@yahoo.co.in9-Aug-17 19:28
Memberramesh1080@yahoo.co.in9-Aug-17 19:28 
AnswerRe: Website down frequently in windows server 2008 standard IIS 7 Pin
Nathan Minier11-Aug-17 1:37
professionalNathan Minier11-Aug-17 1:37 
QuestionTrying to create modal dialog using jQuery Pin
indian1439-Aug-17 6:50
Memberindian1439-Aug-17 6:50 
AnswerRe: Trying to create modal dialog using jQuery Pin
Richard Deeming9-Aug-17 8:28
mveRichard Deeming9-Aug-17 8:28 
You've specified autoOpen:false, so the first time you click the button, the dialog is created but never shown.

The next time you click the button, you create a new <div> with the same ID, and append it to the body. IDs are supposed to be unique, so the #dialog selector only returns the first element with that ID. Since the dialog(...) call is what hides the element, the subsequent elements are never hidden, and appear at the end of the body.

You need to change the code so that it uses the existing element on subsequent clicks:
$('#btnViewJob').click(function(event) {
    event.preventDefault();
    
    var mytext = 'My first modal dialog using MVC: <input type="text" value="Some value comes from parent page" id="temp"' + somevaluecomesfromparentpage + '" />';
    
    var dialog = $("#dialog");
    if (!dialog.length) {
        // First time: create the dialog element:
        dialog = $("<div/>").attr("id", "dialog").appendTo("body");
        
        dialog.dialog({
            autoOpen: false,
            width: 400,
            resizable: false,
            title: "hi there",
            modal: true,
            buttons: {
                "Close": function() {
                    $(this).dialog("close");
                }
            }
        });
    }
    
    dialog.empty().html("<table><tr><td>" + mytext + "</td></tr></table>");
    dialog.dialog("open");
});

Demo[^]



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


GeneralRe: Trying to create modal dialog using jQuery Pin
indian1439-Aug-17 9:39
Memberindian1439-Aug-17 9:39 
GeneralRe: Trying to create modal dialog using jQuery Pin
Richard Deeming9-Aug-17 9:46
mveRichard Deeming9-Aug-17 9:46 
GeneralRe: Trying to create modal dialog using jQuery Pin
indian1439-Aug-17 9:59
Memberindian1439-Aug-17 9:59 
GeneralRe: Trying to create modal dialog using jQuery Pin
Richard Deeming9-Aug-17 10:10
mveRichard Deeming9-Aug-17 10:10 
GeneralRe: Trying to create modal dialog using jQuery Pin
indian1439-Aug-17 11:44
Memberindian1439-Aug-17 11:44 
GeneralRe: Trying to create modal dialog using jQuery Pin
F-ES Sitecore9-Aug-17 23:11
mveF-ES Sitecore9-Aug-17 23:11 
GeneralRe: Trying to create modal dialog using jQuery Pin
indian14310-Aug-17 13:03
Memberindian14310-Aug-17 13:03 
GeneralRe: Trying to create modal dialog using jQuery Pin
F-ES Sitecore10-Aug-17 22:09
mveF-ES Sitecore10-Aug-17 22:09 
GeneralRe: Trying to create modal dialog using jQuery Pin
indian14311-Aug-17 13:13
Memberindian14311-Aug-17 13:13 
GeneralRe: Trying to create modal dialog using jQuery Pin
F-ES Sitecore13-Aug-17 22:18
mveF-ES Sitecore13-Aug-17 22:18 
QuestionProcedure or function 'sp_getchech' expects parameter '@ID', which was not supplied Pin
samflex9-Aug-17 5:24
Membersamflex9-Aug-17 5:24 
AnswerRe: Procedure or function 'sp_getchech' expects parameter '@ID', which was not supplied Pin
Richard Deeming9-Aug-17 8:14
mveRichard Deeming9-Aug-17 8:14 
GeneralRe: Procedure or function 'sp_getchech' expects parameter '@ID', which was not supplied (SOLVED) Pin
samflex9-Aug-17 14:54
Membersamflex9-Aug-17 14:54 
QuestionWhat is better solutions for complex application and databases Pin
Lakhpat-Singh8-Aug-17 7:22
MemberLakhpat-Singh8-Aug-17 7:22 
AnswerRe: What is better solutions for complex application and databases Pin
F-ES Sitecore9-Aug-17 0:00
mveF-ES Sitecore9-Aug-17 0:00 
QuestionGetting Route Values in Controller Pin
Farhad Eft7-Aug-17 7:20
MemberFarhad Eft7-Aug-17 7:20 
AnswerRe: Getting Route Values in Controller Pin
Richard Deeming7-Aug-17 10:21
mveRichard Deeming7-Aug-17 10:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.