troubleshooting Question

Ajax popup extender - why will it NOT work with a submit button

Avatar of hijiki7777
hijiki7777 asked on
ASP.NETAJAX
1 Comment1 Solution528 ViewsLast Modified:
I want to use a popup where I want to update 2 fields, either manually entered or populated from a drop dow list. So I need a popup with a submit button. I am experimenting with the code from the "How do I" videos. In the video they show a field being updated from a popup with a radiobutton list. I decided to change it so that instead of closing the popup in the radiobutton SelectedIndexChanged event, I removed that and put the code in a button submit event. However I get the message; Microsoft JScript runtime error: 'this._postBackSettings.async' is null or not an object".
protected void btnTest_Click(object sender, EventArgs e)
{
    lblTest.Text = RadioButtonList1.SelectedItem.Text + " hello";
    PopupControlExtender.GetProxyForCurrentPopup(this.Page).Commit(RadioButtonList1.SelectedValue);
    // Reset the selected item
    RadioButtonList1.ClearSelection();
 
}
 
---------------------------------------------------------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
    <link href="StyleSheet.css" rel="stylesheet" type="text/css" />
    <script language="javascript" type="text/javascript">
        function UpdateField(text)
        {
            var test = text + ' - SEND A MEETING REQUEST!';
            $get("MyTextBox").value = test;
//            $get("lblTest").value = test;
//            
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <div>
            <asp:UpdatePanel runat="server" ID="updTest">
                <ContentTemplate>
            <br />
            ToDo:
            <asp:TextBox ID="MyTextBox" runat="server" Width="538px"></asp:TextBox>
            <br />
            <asp:Panel ID="Panel1" runat="server" CssClass="popupControl" DefaultButton="btnTest">
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>
                        <asp:RadioButtonList ID="RadioButtonList1" runat="server"                             Width="146px">
                            <asp:ListItem Text="Scott Guthrie"></asp:ListItem>
                            <asp:ListItem Text="Simon Muzio"></asp:ListItem>
                            <asp:ListItem Text="Brian Goldfarb"></asp:ListItem>
                            <asp:ListItem Text="Joe Stagner"></asp:ListItem>
                            <asp:ListItem Text="Shawn Nandi"></asp:ListItem>
                        </asp:RadioButtonList>
                        <div style="padding:10px;">
                            <asp:Button runat="server" ID="btnTest" Text="Submit" onclick="btnTest_Click"  />
                        </div>
                    </ContentTemplate>
                </asp:UpdatePanel>
            <br />
            <ajaxToolkit:PopupControlExtender ID="PopupControlExtender1" runat="server" CommitProperty="value"
                CommitScript="UpdateField(e.value);" PopupControlID="Panel1"
                Position="Bottom" TargetControlID="MyTextBox">
            </ajaxToolkit:PopupControlExtender>   
            </asp:Panel> 
            <div style="padding:20px;"><asp:Label runat="server" ID="lblTest" Text="Test"/>         </div>
                            </ContentTemplate>
            </asp:UpdatePanel>
 
        </div>
    </form>    
</body>
</html>
ASKER CERTIFIED SOLUTION
hijiki7777

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros