Not signed in (Sign In)

Categories

Welcome, Guest

Want to take part in these discussions? If you have an account, sign in now.

If you don't have an account, apply for one now.

Links

Vanilla 1.0.1 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorPongGod
    • CommentTimeJan 22nd 2010
     
    I just discovered a bizarre side effect when using ThickBox in conjunction with the Ajax UpdatePanel. Basically, I've got a second web form which I use ThickBox to load like a modal popup. When closing the popup form, I call a javascript function on the initial form which uses __doPostBack() to perform a partial page postback. In my code-behind, I respond to this postback by setting text on a label that is wrapped by an UpdatePanel. So far, everything works great. However, at this point I discover that other text boxes on the page that are outside of the UpdatePanel are suddenly disabled! I'm using VS2008 and .NET 3.5:

    [Initial page: Test.aspx]

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test.aspx.cs" Inherits="TestApp.Test" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <title>Test Page</title>

    <script type="text/javascript" src="scripts/jquery-1.3.2.min.js"></script>
    <link rel="stylesheet" type="text/css" href="stylesheets/jquery-ui-1.7.2/themes/base/ui.all.css" />

    <!-- Scripts required by ThickBox modal popup window -->
    <script type="text/javascript" src="scripts/thickbox.js"></script>
    <link rel="stylesheet" href="stylesheets/thickbox.css" type="text/css" media="screen" />

    <script language="javascript" type="text/javascript">
    function refreshDescription1(args) {
    __doPostBack('upDescription', args);
    }
    </script>
    </head>
    <body>
    <form id="form1" runat="server">
    <div style="padding-left: 20px; padding-top: 20px">
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>

    <span>Click here:</span>
    <asp:HyperLink ID="lnkDescription" NavigateUrl="" ImageUrl="~/images/edit.png" CssClass="thickbox" runat="server"></asp:HyperLink>
    <asp:UpdatePanel ID="upDescription" UpdateMode="Conditional" OnLoad="upDescription_Load" runat="server">
    <ContentTemplate>Description:
    <asp:Label ID="lblDescription1" Text="Initial description" runat="server"></asp:Label>
    </ContentTemplate>
    </asp:UpdatePanel>
    <br />Enter something here:
    <asp:TextBox ID="txtName" runat="server"></asp:TextBox>
    </div>
    </form>
    </body>
    </html>

    [Code-behind, Test.aspx.cs]:

    public partial class Test : System.Web.UI.Page
    {
    protected void Page_Load(object sender, EventArgs e)
    {
    if (!Page.IsPostBack)
    {
    this.lnkDescription.NavigateUrl = "Test-ThickboxPopup.aspx?TB_iframe=true&modal=true&height=300&width=600";
    }
    }

    protected void upDescription_Load(object sender, EventArgs e)
    {
    // Refresh displayed values for Description
    if (ScriptManager.GetCurrent(Page).IsInAsyncPostBack)
    {
    string passedArgument = Request.Params.Get("__EVENTARGUMENT");
    this.lblDescription1.Text = passedArgument;
    }
    }
    }

    [Popup form, Test-ThickBoxPopup.aspx]

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test-ThickboxPopup.aspx.cs" Inherits="TestApp.Test_ThickboxPopup" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <title>Test Thickbox Popup Form</title>
    </head>
    <body id="pageBody" runat="server">
    <form id="form1" runat="server">
    <div>
    <h2>Test Thickbox Popup Form</h2>

    <asp:TextBox ID="TextBox1" MaxLength="80" Width="575" runat="server"></asp:TextBox>
    <br /><br />
    <asp:Button ID="btnSave1" Text="Save to Description1" runat="server" onclick="btnSave1_Click" />&nbsp;
    <input id="btnCancel" type="button" value="Cancel" onclick="self.parent.tb_remove();" />
    </div>
    </form>
    </body>
    </html>

    [Code-behind, Test-ThickBoxPopup.aspx.cs]:

    public partial class Test_ThickboxPopup : System.Web.UI.Page
    {
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void btnSave1_Click(object sender, EventArgs e)
    {
    this.pageBody.Attributes.Add("onload", "self.parent.refreshDescription1('" + this.TextBox1.Text + "'); self.parent.tb_remove();");
    }
    }