best way to open a popup with vars

G

Guest

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
 
G

Guest

you make a javascript

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

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

Guest

Thanks,

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

Cheers


Dan

Psycho said:
you make a javascript

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

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



Dan Nash said:
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
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top