locked
NumericUpDownExtender loses state when exit from ModalPopupExtender on page postback RRS feed

  • Question

  • User1909155429 posted

    Inside my modal popup I have a Numeric Extender attached a textbox. Here I set the value and close modal, on return

    I proceed to process data by performing a page postback . The textbox value no longer exists in code behind page ?

     

    Monday, September 22, 2014 7:20 PM

Answers

  • User-1360095595 posted

    It should work. Do you have any code, maybe in page_load, that initialized the textbox to zero or whatever?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, September 23, 2014 1:26 AM
  • User1918509225 posted

    Hi peterthegreat,

    For your issue,i wrote a demo for your:

    <form id="form1" runat="server">
            <ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></ajaxToolkit:ToolkitScriptManager>
          <div>
         <asp:Button ID="BtnOpenModal" runat="server" Text="OpenModal" />          
      <ajaxToolkit:ModalPopupExtender ID="mpeCheck" runat="server" PopupControlID="Panel2" TargetControlID="BtnOpenModal">
        </ajaxToolkit:ModalPopupExtender>
     
        <asp:Panel ID="Panel2" runat="server" CssClass="modalPopup" align="center" Style="display: none">
            <asp:TextBox ID="TextBox1" runat="server" Width="200px"></asp:TextBox>
            <ajaxToolkit:NumericUpDownExtender ID="NumericUpDownExtender1" runat="server" Maximum="100" Minimum="20" Width="100" TargetControlID="TextBox1"></ajaxToolkit:NumericUpDownExtender> 
            <asp:Button ID="Button1" runat="server" Text="Submit"  OnClick="btnYes_Click"/>
        </asp:Panel>
    
          </div>
        </form>

    Here is the server side:

      protected void btnYes_Click(object sender, EventArgs e)
            {
    //You can set a breakpoint here. string text = TextBox1.Text.ToString(); }

    Best Regards,

    Kevin Shen.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, September 23, 2014 3:18 AM

All replies

  • User-1360095595 posted

    It should work. Do you have any code, maybe in page_load, that initialized the textbox to zero or whatever?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, September 23, 2014 1:26 AM
  • User1918509225 posted

    Hi peterthegreat,

    For your issue,i wrote a demo for your:

    <form id="form1" runat="server">
            <ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></ajaxToolkit:ToolkitScriptManager>
          <div>
         <asp:Button ID="BtnOpenModal" runat="server" Text="OpenModal" />          
      <ajaxToolkit:ModalPopupExtender ID="mpeCheck" runat="server" PopupControlID="Panel2" TargetControlID="BtnOpenModal">
        </ajaxToolkit:ModalPopupExtender>
     
        <asp:Panel ID="Panel2" runat="server" CssClass="modalPopup" align="center" Style="display: none">
            <asp:TextBox ID="TextBox1" runat="server" Width="200px"></asp:TextBox>
            <ajaxToolkit:NumericUpDownExtender ID="NumericUpDownExtender1" runat="server" Maximum="100" Minimum="20" Width="100" TargetControlID="TextBox1"></ajaxToolkit:NumericUpDownExtender> 
            <asp:Button ID="Button1" runat="server" Text="Submit"  OnClick="btnYes_Click"/>
        </asp:Panel>
    
          </div>
        </form>

    Here is the server side:

      protected void btnYes_Click(object sender, EventArgs e)
            {
    //You can set a breakpoint here. string text = TextBox1.Text.ToString(); }

    Best Regards,

    Kevin Shen.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, September 23, 2014 3:18 AM
  • User1909155429 posted

    YOU ARE RIGHT !

    It did not like the page format. When I reposition it worked ?

    Thursday, October 2, 2014 8:51 AM
  • User1909155429 posted

    Thanks for the example.

    May I ask why does the Ajax Toolkit disappear from the Toolbox while the data files remain attached to my file system within the Bin Folder !

    How may I attach the Toolkit permanent feature of Toolbox ?

     

    Thursday, October 2, 2014 8:56 AM