Solved

reading textbox value from user control in ajax modal popup extnder

Posted on 2014-09-03
6
1,102 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
[X]
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
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

Are You Using the Best Web Development Editor?

The worlds of web hosting and web development are constantly evolving. Every year we see design trends change, coding standards adapt and new frameworks/CMS created. With such a quick pace of change it’s easy to get lost trying to keep up.

See if your editor made the list.

Question has a verified solution.

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

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

717 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