Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

reading textbox value from user control in ajax modal popup extnder

Posted on 2014-09-03
6
988 Views
Last Modified: 2014-10-24
Parent .aspx Form has 5 buttons. Each opens a ajax modal pop-up extender containing a user control (.uscx).
The uscx is registered, all works well.

Button opening  the modal is  below. The 5 buttons are in sequence  BtnDims1, BtnDims2  etc.  So are all the ID's


 
<asp:Button ID="BtnDims1" runat="server" Text="Dim" Width="31px" Font-Size="XX-Small" ToolTip="Enter Dimensional Load Information" TabIndex="11" />
                        <ajax:ModalPopupExtender ID="BtnDims1_Mpe" runat="server"  Enabled="True" TargetControlID="BtnDims1" PopupControlID="PNLfgtDimension1"   DropShadow="true">
                        </ajax:ModalPopupExtender>
                       <asp:Panel ID="PNLfgtDimension1"  style="display:none;"   runat="server" BorderColor="#212020" BorderStyle="Double" Visible="true" BorderWidth="6px" Width="440px" Height="150px" BackColor="White">
                        <uc1:FgtDemensions runat="server" ID="FgtDimensions1" />
                      </asp:Panel>

Open in new window

The user control has 3 text boxes (TBlength, TBWidth & TBHeight) and one cmd buttom.

After client enters the 3 values  they click the save button, things are saved and the modal closes.  
Now I want to be able to read the values from those text boxes from the parent page.(I know the inputs are still there because when I click on the modal popup button again the inputs still display.)

I can find the main child controls (the panels and forms)  in the control collection but can not successfully get the values from the text boxes.  
I found the user control using this code.
MyModal1 = CType(FindControl("BtnDims1_Mpe"), AjaxControlToolkit.ModalPopupExtender)
Dim fgtcontrol As UserControl = CType(MyModal1.FindControl("FgtDemensions1"), UserControl)

Can someone show me how to read the textboxes?     I know hoe to send vales from a child.
Not having any success at reading (pulling) from a child.

Thanks!
0
Comment
Question by:ash691
6 Comments
 
LVL 25

Expert Comment

by:Ron Malmstead
ID: 40303269
You can save it in the session when they click submit.

Session("height") = btnDims.text

.. Then read the value back on the main form.  Make sure you clear the values after using them.

Dim theheight as string = Session("height")
Session("height") = ""
0
 
LVL 12

Expert Comment

by:Ramkisan Jagtap
ID: 40303336
If you use the developer tool in the browser you can track the hierarchy of the controls in your modal popup.
then you can try finding them using .FindControl(). But it will be bit complex.

Best way is to store that values in session or in the viewstate.
0
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 40303398
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.js"></script>

attach an event to your button in your modal popup :

$("#<%= Close.ClientID %>").click(function() {
      $.cookie("TextBox1inModal", $("#<%= TextBox1.ClientID").val() );
      $.cookie("TextBox2inModal", $("#<%= TextBox2.ClientID").val() );
});

Open in new window


Now in your parent page, you can read teh value by reading the cookies :
$.cookie("TextBox1inModal");
and :
$.cookie("TextBox2inModal");
0

Featured Post

The New “Normal” in Modern Enterprise Operations

DevOps for the modern enterprise offers many benefits — increased agility, productivity, and more, but digital transformation isn’t easy, especially if you’re not addressing the right issues. Register for the webinar to dive into the “new normal” for enterprise modern ops.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question