locked
Getting changed value from modalpopupextender RRS feed

  • Question

  • User31164289 posted

    Hi,

    I need to use modalpopupextender to confirm some value in my webform and perform some action.

    User can change some value in textbox on modalpopupextemder and apply mod.

    Problem is that when execute server side function, text box value in modalpopupextender was some before change.

    There is a way to get changed value in control on modalpopupextender?

     <tk:ModalPopupExtender ID="mp1" runat="server" PopupControlID="Panl1" TargetControlID="cmdInizioLavoro"
            CancelControlID="cmdAnnulla"  BackgroundCssClass="Background" DropShadow="True"  >
        </tk:ModalPopupExtender>
    
        <asp:Panel ID="Panl1" runat="server" CssClass="Popup" align="center" style="display:none">            
            <div style="background-color: ButtonFace;border-color:black; border-style:outset;height:290px;width:400px" class="content-box-header">            
                <br />            
                        <asp:Label runat="server" ID="Label85" Text="CONFERMA DATI" Font-Bold="true" ></asp:Label>
                        <br />
                        <br />
                        <asp:Label runat="server" ID="Label62" Text="Seriale" AssociatedControlID="txtSeriale" meta:resourcekey="Label8Resource1"></asp:Label>
                        <asp:TextBox runat="server" CssClass="text-input large-input" Autocomplete="Off"  ID="txtSeriale" ></asp:TextBox>
                        <br/>
                        <asp:Label runat="server" ID="Label86" Text="Modello" AssociatedControlID="txtModello" meta:resourcekey="Label2Resource1"></asp:Label>
                        <asp:TextBox runat="server" CssClass="text-input large-input" Autocomplete="Off"  ID="txtModel" ></asp:TextBox>
                        <br/>
                        <br/>
                        <asp:Label runat="server" ID="Label87" Text="Modello" AssociatedControlID="txtAccessories" meta:resourcekey="Label10Resource1"></asp:Label>
                        <asp:TextBox runat="server" CssClass="text-input large-input" Autocomplete="Off"  ID="txtAccessories" ></asp:TextBox>
    
                <div style="float:right;padding-right:20px;padding-top:20px">
                    <asp:Button ID="cmdAnnulla" runat="server" Text="Annulla"  CssClass="button" CausesValidation="false" />
                    <asp:Button ID="cmdConferma" runat="server" Text="Conferma" CssClass="button" CausesValidation="false" OnClick="cmdConferma_Click"/>
                </div>            
            </div>
                
        </asp:Panel>
    
        <asp:Button runat="server" ID="Button1" Text="Inizio lavoro" CausesValidation="False" style="float: right; margin: 5px" CssClass="button" meta:resourcekey="cmdInizioLavoroResource1" />

    And my server side code

     Protected Sub cmdConferma_Click(sender As Object, e As EventArgs) Handles cmdConferma.Click
    
            Dim AccessoriMod As Boolean
            Dim SerialeMod As Boolean
            Dim ModelloMod As Boolean
    
            If txtAccessori.Text <> txtAccessories.Text Then
                AccessoriMod = True
            End If
    
            If txtModel.Text <> txtModello.Text Then
                ModelloMod = True
            End If
    
            If txtSeriale.Text = txtSerialNumber.Text Then
                SerialeMod = True
            End If
    
            If ModelloMod Or AccessoriMod Or SerialeMod Then
              ' execute update in DB
            End If
    
    End  Sub

    Monday, April 27, 2015 3:19 PM

Answers

  • User-577741185 posted

    Problem is that when execute server side function, text box value in modalpopupextender was some before change.

    Where are you setting the TextBox Text property initially? If it's in page load, you need to check for post back.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, April 27, 2015 3:34 PM

All replies

  • User-577741185 posted

    Problem is that when execute server side function, text box value in modalpopupextender was some before change.

    Where are you setting the TextBox Text property initially? If it's in page load, you need to check for post back.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, April 27, 2015 3:34 PM
  • User61956409 posted

    Hi clembo67,

    Thanks for your post.

    Firstly, I’m glad to hear that you resolve the problem.

    Secondly, this article explained with an example and attached sample code, how to use ASP.Net AJAX Control Toolkit ModalPopupExtender Control to add, edit, insert and update rows in ASP.Net GridView, it will be helpful.

    Fei Han

    Tuesday, April 28, 2015 5:52 AM