1. This works great. - <a href="javascript:void(0)" onclick="window.open('adddept.aspx','welcome','width=400,height=250')">Add a Department </a>
2. I am trying to Pass a value "txtParentID" to pop up window "txtChildID"
I found a java for the second item. but how do I get # 1 to execute the java function after it opens up pop up window. http://aspadvice.com/blogs/azamsharp...nt-Window.aspx 14 3636 - <a href="javascript:void(0)" onclick="window.open('Assign_Dept.aspx?value = " + txtParent.Text + " ','welcome','width=400,height=250')">
-
Assign Dept test</a>
theParent.Text is in red and it tells me is not a valid attribute of a. what would be the right syntax?
gits 5,390
Expert Mod 4TB
the first param in the window.open() method should look like this: - 'Assign_Dept.aspx?value = \"' + txtParent.Text + '\"'
kind regards
Hi gits, I tried your suggession but still nothing happens when I click on the button.
This is my textbox - <asp:TextBox ID="txtParent" runat="server" ></asp:TextBox></td>
Here is the href - <a href="javascript:void(0)" onclick="window.open('Assign_Dept.aspx?value = \"' + txtParent.Text + '\"','welcome','width=400,height=250')">
-
Assign Dept test</a>
Any help will be truly appreciated as I spend more than 8 hours on this.
gits 5,390
Expert Mod 4TB
when you call: - alert('Assign_Dept.aspx?value = \"' + txtParent.Text + '\"');
in your onclick handler, does the alert show you the correct url?
kind regards
This works but I need to pass value. - <a href="javascript:void(0)" onclick="window.open('Assign_Dept.aspx','welcome','width=400,height=250')">Assign Dept. </a>
gits 5,390
Expert Mod 4TB
did the alert work?
kind regards
Alert works on the first href but does not work on the 2nd href. - <a href="javascript:void(0)" onclick="alert('Assign_Dept.aspx','welcome','width=400,height=250')">Assign Dept. </a>
-
<br />
-
<br />
-
<a href="javascript:void(0)" onclick="window.open('Assign_Dept.aspx?value = \"' + txtParent.Text + '\"','welcome','width=400,height=250')">
-
Assign Dept test</a>
gits 5,390
Expert Mod 4TB
try the following ... we separate the build of the url here: - onclick="var url = 'Assign_Dept.aspx?value = \"' + txtParent.Text + '\"'; window.open(url,'welcome','width=400,height=250')"
this should work otherwise please tell what value the variable has ...
kind regards
- <a href="javascript:void(0)" onclick="var url = 'Assign_Dept.aspx?value = \"' + txtParent.Text + '\"'; window.open(url,'welcome','width=400,height=250')" >
-
Assign Dept </a>
Not working. Nothing happens.
txtParent.text has integer (string to be correct) in it. I am populating this text box when I select a row from a gridview. and I can see it's been populated after i select a row. -
protected void GridView2_SelectedIndexChanged(object sender, EventArgs e)
-
{
-
txtParent.Text = GridView2.SelectedValue.ToString();
-
}
gits 5,390
Expert Mod 4TB
ahhhrg .... tried it myself now and we get an unterminatetd string-literal at the first double quote, just try it without concatenating the double quotes: - var url = 'Assign_Dept.aspx?value=' + txtParent.Text;
as far as i'm aware you don't need them, and in case you do we could try the encodeURIComponent() method, since it seems that in the onclick the escape of the double quotes didn't work. you could even write a function in an extra script-block and call the function in your onclick, that would circumvent this silly problem.
kind regards
I am going to give up after 3 day mission on this. Thanks gits for keeping up with me and helping me.
gits 5,390
Expert Mod 4TB
the last suggestions i gave above should work ... personally i would prefer the function wrapper way. just put a function like below in a script section in the head of your page: - function openMyWindow() {
-
var url = 'foo.html?value="' + myValue + '"';
-
-
window.open(url, // more params here);
-
}
now in your onclick handler just call:
it's a too small problem to just give up ;) ...
kind regards
gits,
Thanks for keeping up with me on this. I understand what you said about not giving up. Thanks for keeping me up and not give up.
Guess what. it FINALLY WORKED. I am posting the final code in case someone wants to implement this.
parent.aspx
1. Put this script before head (form1 is the name of my form where txtParent form is located -
<script type="text/javascript" language="javascript">
-
function openMyWindow() {
-
var myValue = form1.txtParent1.value
-
var url = 'PopUp.aspx?value=' + myValue + '';
-
-
window.open(url); // more params here, like width, height, etc.
-
}
-
</script>
2. This is my Click Text (you can use button) - <a href="javascript:void(0)" onclick="openMyWindow()">Open Pop - Bytes</a>
3. popup.aspx , put this code on the pageload of popup.aspx -
string strP = Request["value"].ToString();
-
txtPopup2.Text = strP;
ALL THE THANKS TO gits because he has lots of patience and never gave up on me. Thank you gits.
gits 5,390
Expert Mod 4TB
glad to hear you got it working ;) ... in case you would have more questions just post back to the forum ;)
kind regards,
gits
Sign in to post your reply or Sign up for a free account.
Similar topics
by: DamonChong |
last post by:
Hi,
I am still struggling to master C++ and is trying to understand how to
achieve passing arguments using pointers. I got some questions that I
like to post to the experts here, hope you can...
|
by: DCB |
last post by:
Hello.
I have an easy question, likely, that has me in a headspin. I have an
include file to a frames based site that basically forces frames on
the end user if they visit the site and hit a...
|
by: Peter |
last post by:
I have a webform on this form is a User Control and another webform in
IFRAME
On the User Control there is a save button.
I want to click this button and somehow tell the webpage in IFRAME that...
|
by: ab_j |
last post by:
I have a user control that contains a dropdown which I want to use as a
menu on multiple .aspx pages. Basically, all I am trying to do is pass
the selected value of the dropdown in the user...
|
by: darrel |
last post by:
I'm still trying to fully understand how best to pass variables between
pages/usercontrols/each other.
On a current site I've done, I've had one userControl do the logic and set
the variable,...
|
by: kath |
last post by:
hi everyone.........
I have a task, I have fragmented the task into subtask. I have planned
to create a class to each subclass and one parent class to handle the
sub tasks. Each subclass are...
|
by: BigZero |
last post by:
Hello,
i need to pass some variables or value to javascript from php script.
well all i need to pass to value to javascript that is with in same
php file the two values r in php i need to pass...
|
by: Rob |
last post by:
I have a control (Button) on a Parent form which opens a Windows form... all
I want to do is pass a value from the child form back to the parent... it
should be so simple... i.e....
|
by: raylopez99 |
last post by:
Keywords: scope resolution, passing classes between parent and child
forms, parameter constructor method, normal constructor, default
constructor, forward reference, sharing classes between forms....
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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...
|
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...
|
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,...
| |