473,396 Members | 2,014 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Return Values from Popup to UserControl

Hi,

Can anyone tell me please how can I return values from a popup to a
UserControl. I use the same "method" like to return to a WebForm, but it not
works in UserControl case.
I have this code to return from popup to webform:
------------------------------------------------------------------------
sbScript.Append("<script language='javascript'>")
sbScript.Append(Environment.NewLine)
sbScript.Append("window.opener.document.forms[0].elements['")
sbScript.Append(Request.QueryString("srcA"))
sbScript.Append("'].value = '")
sbScript.Append(strYear)
sbScript.Append("';")

sbScript.Append(Environment.NewLine)
sbScript.Append("window.opener.document.forms[0].elements['")
sbScript.Append(Request.QueryString("srcM"))
sbScript.Append("'].value = '")
sbScript.Append(strMonth)
sbScript.Append("';")

sbScript.Append(Environment.NewLine)
sbScript.Append("window.opener.document.forms[0].elements['")
sbScript.Append(Request.QueryString("srcD"))
sbScript.Append("'].value = '")
sbScript.Append(strDay)
sbScript.Append("';")

sbScript.Append(Environment.NewLine)
sbScript.Append("window.close();")
sbScript.Append(Environment.NewLine)
sbScript.Append("</script>")
RegisterStartupScript("CloseDate", sbScript.ToString())
------------------------------------------------------------------------
--
Programming ASP.NET with VB.NET

Thank's (if you try to help me)
Hope can help (if I try to help)

ruca
Dec 14 '06 #1
2 1637
Hi,

ruca wrote:
Hi,

Can anyone tell me please how can I return values from a popup to a
UserControl. I use the same "method" like to return to a WebForm, but it not
works in UserControl case.
Usually, when something works for a Page but not for a Control, it's an
ID problem. Be aware that when a control gets added to the page, all its
children controls get a different ID from the one set using the ID
attribute. This is to guarantee that all the IDs on the page are unique.

Inspect your produced HTML code using view-source. The control's unique
ID can be obtained on the server using myControl.ClientID.
I have this code to return from popup to webform:
------------------------------------------------------------------------
sbScript.Append("<script language='javascript'>")
Deprecated. Use

<script type="text/javascript">

instead.

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Dec 14 '06 #2
Hi,

But this control is used in many pages
How can I specifief or pass the ID into my UserControl, since is this that
opens my popup????

--
Programming ASP.NET with VB.NET

Thank's (if you try to help me)
Hope can help (if I try to help)

ruca

"Laurent Bugnion" <ga*********@bluewin.chescreveu na mensagem
news:uo**************@TK2MSFTNGP03.phx.gbl...
Hi,

ruca wrote:
>Hi,

Can anyone tell me please how can I return values from a popup to a
UserControl. I use the same "method" like to return to a WebForm, but it
not works in UserControl case.

Usually, when something works for a Page but not for a Control, it's an ID
problem. Be aware that when a control gets added to the page, all its
children controls get a different ID from the one set using the ID
attribute. This is to guarantee that all the IDs on the page are unique.

Inspect your produced HTML code using view-source. The control's unique ID
can be obtained on the server using myControl.ClientID.
>I have this code to return from popup to webform:
------------------------------------------------------------------------
sbScript.Append("<script language='javascript'>")

Deprecated. Use

<script type="text/javascript">

instead.

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch

Dec 14 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Nicholas Then | last post by:
I have a usercontrol that contains a datagrid. This grid lists information from my database. No big deal...this works fine, and when the user selects an item I have a popup window appear with...
2
by: Balamurukan | last post by:
How to retrive property values from our own property window
0
by: Rabeek Ahamed | last post by:
I am calling a popup window from the main page. That popup has to return list of values in an array. How can i return arrays to main page from pop up? And I want to list those array of values into...
1
by: Jorge Ponte | last post by:
hi I have a Web User Control (ascx) - lets call it "My_WUC" - in a Web form. In that WUC I want have a textbox and a button. I want to click on the button and open a popup (I use javascript for...
1
by: billy | last post by:
Ok, here's the situation... I have a user control that contains two textboxes (one for a from date/time and one for a to date/time) and two image buttons. The user control itself is supposed to...
2
by: Simon Verona | last post by:
I have a problem, best explained by example. I have a usercontrol which contains a text box and a button. If the button is clicked then the calender control is displayed as a "popup" so that a...
3
by: Kevin Attard | last post by:
Hi, Is there a way to return a value from a control inside a popup and assign it to a control inside the parent form? Thanks, kev
2
by: ruca | last post by:
Hi, Can anyone tell me please how can I return values from a popup to a UserControl. I use the same "method" like to return to a WebForm, but it not works in UserControl case. I have this...
9
by: Academia | last post by:
ContextMenu has a Popup event but MainMenu does not. I need Popup with MainMenu. Do you know anyway to simulate it? Thanks in advance
1
by: perhapscwk | last post by:
I use below to popup a page "popup" and then pass the value from popup and back to my page. see below However, how to return 2 values? I can return 1 value only. function openModal() { ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.