Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Textbox in Updatepanel doesnt submit text

Status
Not open for further replies.

senglory

Programmer
Aug 11, 2009
4
RU
Hi,

Here's my ASPX page:
Code:
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/DEF.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>


<asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolderBodyAreaClass" runat="server">
        <link href="Content/css/jquery-ui.css" rel="stylesheet" type="text/css" />
        <link href="Content/CSS/AdminStyles.css" rel="stylesheet" type="text/css" />
</asp:Content>

<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">

    <script type="text/javascript" src="Scripts/js/jquery-1.11.2.js"></script>
    <script type="text/javascript" src="Scripts/js/jquery-ui.js"></script>

</asp:Content>


<asp:Content ID="BodyContent" ContentPlaceHolderID="PlaceHolderMain" runat="server">

    <asp:UpdatePanel ID="UpdatePanel4" runat="server"  >
        <ContentTemplate>
            <asp:Label ID="lblError" runat="server"  ForeColor="Red" Text=""></asp:Label>
            <asp:Button ClientIDMode="Static" ID="Button1" runat="server" Text="DIALOG" 
                OnClientClick="Dlg();return false;" 
                />
        </ContentTemplate>
    </asp:UpdatePanel>

    <div id="dialogQuests" class="dialogQuestsClass">
        <div class="headerDivBlock">QUESTION</div>
        <div class="contentDivBlock">
            <asp:UpdatePanel ID="UpdatePanel6" runat="server" >
                <ContentTemplate>
                    <table id="tableSizePositionQuest">
                        <tr>
                            <td>Group:</td>
                            <td>
                                <asp:TextBox ID="txtGroup" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <asp:Button ID="btnQuestSave" runat="server" UseSubmitBehavior="false" Text="Save ASYNC" OnClick="btnQuestSave_Click"  />
                            </td>
                        </tr>
                    </table>
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
    </div>


    <script type="text/javascript">

        function Dlg()
        {
            $('#dialogQuests').dialog({ minWidth: 840, resizable: true });
        }

    </script>

</asp:Content>

When I click on "Save ASYNC" button txtGroup comes empty in btnQuestSave_Click. I wonder what's wrong with my project.
 
 http://files.engineering.com/getfile.aspx?folder=0dade052-7710-406a-9e93-6a4fda06dd90&file=WebApplication1.zip
Without UseSubmitBehavior it won't show me this dialog box at all.
 
I don't know much about UpdatePanels, I never use them.
But I believe you need to added a trigger to the updatepanel for the button and you need to move the label into the contenttemplate of the updatepanel
 
Adding triggers doesn't work at all because it's about external controls to be used as an event source for updatepanel. All internal controls are included in triggers by default. Also I tried your idea with expected result - no text, no server function call.
 
Sorry, I used google to get my ideas, like I said, i never use update panels
good luck

post your answer when you get it
 
Hi guys,

I seem to have found the solution. See the link:
JavaScript:
            Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
            function EndRequestHandler(sender, args) {
                var elId = sender._activeElement.id;

                if (elId.indexOf("btnAddTypeQuest") > -1 || elId.indexOf("btnEditQuest") > -1) {
                    $('#dialogQuests').dialog({
                        maxHeight: 600,
                        minWidth: 840,
[b]                        open: function (type, data) {
                            $(this).parent().appendTo("form");
                        }
[/b]                    });
                }

                if (args.get_error() != undefined) {
                    args.set_errorHandled(true);
                }
            }

The crucial thing is in bold.
 
Thanks for posting your solution. It may help someone in the furture
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top