Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8678567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:45:14+00:00 2026-06-12T20:45:14+00:00

I have a web page in ASP.net and C# (I’m using visual studio 2010

  • 0

I have a web page in ASP.net and C# (I’m using visual studio 2010 if that helps at all), and I wanted to get a modal popup box going after a button click event. I can’t use AJAX because I’m not allowed to install the extension on the server…so I have tried out the javascript method provided by yensdesign.

The problem I have is that the button I’ve set up just doesn’t do anything…I am guessing that since I am calling this from an asp.net web page instead of standard html I need to do something extra but a day of googling, asking everyone I know, and trial and error have not yielded any results so here I am…

I have the following in my ‘scripts’ folder called popupAdminTasks.js:

/***************************/
//@Author: Adrian "yEnS" Mato Gondelle
//@website: www.yensdesign.com
//@email: yensamg@gmail.com
//@license: Feel free to use it, but keep this credits please!                  
/***************************/

//SETTING UP OUR POPUP
//0 means disabled; 1 means enabled;
var popupStatus = 0;

//loading popup with jQuery magic!
function loadPopup() 
{
    //loads popup only if it is disabled
    if (popupStatus == 0) {
        $("#backgroundPopup").css({
            "opacity": "0.7"
        });
        $("#backgroundPopup").fadeIn("slow");
        $("#popupContact").fadeIn("slow");
        popupStatus = 1;
    }
}

//disabling popup with jQuery magic!
function disablePopup() 
{
    //disables popup only if it is enabled
    if (popupStatus == 1) {
        $("#backgroundPopup").fadeOut("slow");
        $("#popupContact").fadeOut("slow");
        popupStatus = 0;
    }
}

//centering popup
function centerPopup() 
{
    //request data for centering
    var windowWidth = document.documentElement.clientWidth;
    var windowHeight = document.documentElement.clientHeight;
    var popupHeight = $("#popupContact").height();
    var popupWidth = $("#popupContact").width();
    //centering
    $("#popupContact").css({
        "position": "absolute",
        "top": windowHeight / 2 - popupHeight / 2,
        "left": windowWidth / 2 - popupWidth / 2
    });
    //only need force for IE6
    $("#backgroundPopup").css({
        "height": windowHeight
    });
}

//CONTROLLING EVENTS IN jQuery
$(document).ready(function () {

    //LOADING POPUP
    //Click the button event!
    $("#btnViewTimesheet").click(function () {
        //centering with css
        centerPopup();
        //load popup
        loadPopup();
    });

    //CLOSING POPUP
    //Click the x event!
    $("#popupBtnClose").click(function () {
        disablePopup();
    });
    //Click out event!
    $("#backgroundPopupAdminTasks").click(function () {
        disablePopup();
    });
    //Press Escape event!
    $(document).keypress(function (e) {
        if (e.keyCode == 27 && popupStatus == 1) {
            disablePopup();
        }
    });

});

So that’s great. I then have my css file which has all the normal stuff in it, with the extras at the bottom as follows:

/* POPUP BOX  
----------------------------------------------------------*/
#backgroundPopup
{  
    display:none;  
    position:fixed;  
    _position:absolute; /* hack for internet explorer 6*/  
    height:100%;  
    width:100%;  
    top:0;  
    left:0;  
    background:#000000;  
    border:1px solid #cecece;  
    z-index:1;  
} 

#popupAdminTasks
{  
    display:none;  
    position:fixed;  
    _position:absolute; /* hack for internet explorer 6*/  
    height:384px;  
    width:408px;  
    background:#FFFFFF;  
    border:2px solid #cecece;  
    z-index:2;  
    padding:12px;  
    font-size:13px;  
}  

#popupAdminTasks h1
{  
    text-align:left;  
    color:#6FA5FD;  
    font-size:22px;  
    font-weight:700;  
    border-bottom:1px dotted #D3D3D3;  
    padding-bottom:2px;  
    margin-bottom:20px;  
}  

#popupBtnClose
{  
    font-size:14px;  
    line-height:14px;  
    right:6px;  
    top:4px;  
    position:absolute;  
    color:#6fa5fd;  
    font-weight:700;  
    display:block;  
}  

#btnViewTimesheet
{  
    margin:100px;  
}  

Wonderful. So now we come to the actual aspx file…well this is a bit more tricky as obviously I’m not just doing a test project so instead of having a head section, I have a headcontent section etc…anyway, here’s the relevant bits and bobs:

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <link rel="stylesheet" href="../Styles/AdminPage.css" type="text/css" media="screen" />
    <script src="http://jqueryjs.googlecode.com/files/jquery-1.2.6.min.js" type="text/javascript"></script>  
    <script src="../Scripts/popupAdminTasks.js" type="text/javascript"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div id="btnViewTimesheet">
        <input type="submit" value="View/Edit Timesheet" />
    </div>
    <div id="popupAdminTasks" runat="server">
        <a id="popupBtnClose">X</a>
        <h1>What would you like to do?</h1>
        <p id="popupAdminTasksBody">
            <asp:ImageButton ID="imgBtnCalendar" runat="server" Height="70px" Width="65px"
                ImageUrl="~/Images/calendar.png" AlternateText="View/Edit Timesheet" />
        </p>
    </div>
    <div id="backgroundPopupAdminTasks">
    </div>
</asp:Content>

So…This all builds without error, but I press the button btnViewTimesheet and nothing happens…any ideas?? The thing I keep thinking is that I don’t have an on-click event in the C# code and I would have thought I would need this, and point to the js code from that event but everything I have read and people I’ve spoken to have told me that no, I shouldn’t need this, because the javascript should do it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T20:45:15+00:00Added an answer on June 12, 2026 at 8:45 pm

    The problem is that you have the wrong element ID’s in your jQuery selector.

    You should change backgroundPopup to popupAdminTasks and popupContact to something else.

    http://jsfiddle.net/2mSkM/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a web page (ASP.NET) that includes a stylesheet to mimic Dynamics
I have a ASP.NET web page that contains many textboxes. Each textbox has a
I have to do a asp.net web page that when load will say something
I'm developing on asp.net using infragistics controls. I have develop a web page where
I 'm new to the asp.net. I have created one web page in that
Using ASP.NET MVC 3 with C# I have a web page to display a
I have a web page that has an HTML table generated by an ASP.NET
I have an asp.net web page with a ton of code that is handled
I have a web page written in ASP.NET and I need to retrieve the
I have an ASP.NET web page(Not MVC ) (HomePage.aspx) and another page (PRiceList.aspx).I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.