Solved

Problem with Popup

Posted on 2014-08-10
4
254 Views
Last Modified: 2014-08-12
Hi,
Having these codes below
    <link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
    <script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
    <script type="text/javascript">
        $(function () {
            $("#myPanel").dialog({
                autoOpen: false,
                autoResize: true,
                resizable: false,
                title: "Confirmation",
                open: function (event, ui) {
                    $(this).parent().appendTo("form");
                }
            });

        });

        function closePopup() {
            $("#myPanel").dialog("close");
        }

        function openPopup() {
            $("#myPanel").dialog("open");
        }
    </script>
	<script language="C#" runat="server">
        private void clickOK(object sender, EventArgs e)
        {
            ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "ClosePopup", "closePopup();", true);
        }
	</script>
    ...
    <cc1:ToolkitScriptManager runat="server"></cc1:ToolkitScriptManager>
	<asp:panel id="myPanel" runat="server">
		<input type="textbox" id="tb_msg" style="height:20px; width:116px; border:inherit; background-color:#F0FAF9;" runat="server" />
		<br /><br />
        <div style="text-align:center;">
		    <asp:Button id="OKButton" OnClick="clickOK" runat="server" Text="OK"/>
        </div>
	</asp:panel>
	...
                        tb_msg.Value = "Testing 2";
                        ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "OpenPopup", "openPopup();", true);
                        ...

Open in new window

the last line above is not able to show the Popup within Code-behind. why?
0
Comment
Question by:HuaMinChen
  • 2
  • 2
4 Comments
 
LVL 16

Expert Comment

by:hjgode
ID: 40253748
I am not sure if this is related, but at http://aspsnippets.com/Articles/Open-Show-jQuery-UI-Dialog-Popup-Window-from-Server-Side-Code-Behind-in-ASPNet.aspx you see


    protected void btnShowPopup_Click(object sender, EventArgs e)
    {
        string message = "Message from server side";
        ClientScript.RegisterStartupScript(this.GetType(), "Popup", "ShowPopup('" + message + "');", true);
    }

where is uses RegisterStartupScript and not RegisterClientScriptBlock
0
 
LVL 10

Author Comment

by:HuaMinChen
ID: 40254524
Thanks. even if I have these instead

                        tb_msg.Value = "Testing 2";
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "openPopup", "openPopup();", true);
                        ...

Open in new window

I still get no message prompted, when running the re-deployed project.
0
 
LVL 16

Accepted Solution

by:
hjgode earned 225 total points
ID: 40254833
Then I would start over and test the code at http://aspsnippets.com/Articles/Open-Show-jQuery-UI-Dialog-Popup-Window-from-Server-Side-Code-Behind-in-ASPNet.aspx . If that works, I would change that in small pieces to get to the function that you need.
0
 
LVL 10

Author Comment

by:HuaMinChen
ID: 40254871
Thanks. I get some other problem when using your sample code.

The point is, why my original codes do not work as expected.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now