469,950 Members | 2,353 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,950 developers. It's quick & easy.

best way to open a popup with vars

Hi

I want to be able to click an item in a list, and a new window popup.
Obviously i would use window.open in javascript within a RegisterClientScript
thingy.

However, i want to pass the id of the selected list item to the new popup
window. SO presumably i cant use RegisterClientScript?

How would I go about this, so I can call

private void ListBox_Click
{
window.open(popup.aspx?id=listbox_selected
}

Any help aprpeciated!

Cheers
Dan
Nov 18 '05 #1
3 1448
you make a javascript

function open(listBoxName) {
list = document.getElementByName(ListBoxName);
i = list.selectedIndex;
val = list.options[i].value;
window.open('blabla?id='+val);
}

try to put this script on your button which open the pop-up .

"Dan Nash" wrote:
Hi

I want to be able to click an item in a list, and a new window popup.
Obviously i would use window.open in javascript within a RegisterClientScript
thingy.

However, i want to pass the id of the selected list item to the new popup
window. SO presumably i cant use RegisterClientScript?

How would I go about this, so I can call

private void ListBox_Click
{
window.open(popup.aspx?id=listbox_selected
}

Any help aprpeciated!

Cheers
Dan

Nov 18 '05 #2
Thanks,

But how do I make that Javascript execute from the
ListBox_SelectedIndexChanged event?

Cheers
Dan

"Psycho" wrote:
you make a javascript

function open(listBoxName) {
list = document.getElementByName(ListBoxName);
i = list.selectedIndex;
val = list.options[i].value;
window.open('blabla?id='+val);
}

try to put this script on your button which open the pop-up .

"Dan Nash" wrote:
Hi

I want to be able to click an item in a list, and a new window popup.
Obviously i would use window.open in javascript within a RegisterClientScript
thingy.

However, i want to pass the id of the selected list item to the new popup
window. SO presumably i cant use RegisterClientScript?

How would I go about this, so I can call

private void ListBox_Click
{
window.open(popup.aspx?id=listbox_selected
}

Any help aprpeciated!

Cheers
Dan

Nov 18 '05 #3
Hi DAN,

write a javascript method which build the URL and then pass the same in the
window,.open method it will look something like below.
<script>
function PopUpWindow()
{
var sVal = ListBox1.options[ListBox1.Selectedindex].value;
var sURL = 'popup.aspx?id=' + sVal ;
window.open(sURL);
}
</script>

and in the Code behind page_load event for the ListBox add the below code

ListBox1.Attribuites.Add("onchange","PopUpWindow() ");

thats all everything works fine later
---------------------
Praveen K
---
"Dan Nash" wrote:
Hi

I want to be able to click an item in a list, and a new window popup.
Obviously i would use window.open in javascript within a RegisterClientScript
thingy.

However, i want to pass the id of the selected list item to the new popup
window. SO presumably i cant use RegisterClientScript?

How would I go about this, so I can call

private void ListBox_Click
{
window.open(popup.aspx?id=listbox_selected
}

Any help aprpeciated!

Cheers
Dan

Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by venkatesh | last post: by
4 posts views Thread by Phillip Parr | last post: by
2 posts views Thread by Mike Button | last post: by
23 posts views Thread by Markus | last post: by
13 posts views Thread by ldan | last post: by
7 posts views Thread by anthony.turcotte | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.