470,625 Members | 2,015 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

DataList [Edit Item Template] LinkButton call Javascript to open new window

I have a DataList; in the DataList's [EditItemTemplate], I have a LinkButton
and a few listboxes.
When the LinkButton is pressed, I need to get the ID of the selected item in
one of the Listbox controls.
Then I want to launch another web page in a seperate window, using that ID.

In the header of the web page, I have a javascript function
LaunchMyWindow(iID) that launches that window.

For a normal LinkButton Control, I could just use
LinkButton.Attributes.Add() in the code-behind Page.OnInit() to add a call
to the javascript function. But:
1) I can't access the LinkButton from OnInit(), because it's inside the
DataList, and
2) (more importantly) the LinkButton needs to get an ID out of the listbox.

I know I could use the ItemCommand on the DataList in the code-behind to
Redirect to the page I want to go to, but I need it to be a popup....

Help?
Nov 17 '05 #1
1 5092
Nevyn,

On the page's post back when the link button is clicked get the id you need.
Then instead of doing a response.redirect (which, as you've stated wouldn't
be a popup) attach your popup script to the body tag of the page.

You can do this by making the body tag into a server control. Then you can
add the javascript to open your window to the body tag's onload event.

I have an example of how to make the body tag into a server control on my
website, www.aboutfortunate.com. Just search the code library for: "use body
tag as server control" or something similar.

Sincerely,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"Nevyn Twyll" <as****@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I have a DataList; in the DataList's [EditItemTemplate], I have a LinkButton and a few listboxes.
When the LinkButton is pressed, I need to get the ID of the selected item in one of the Listbox controls.
Then I want to launch another web page in a seperate window, using that ID.
In the header of the web page, I have a javascript function
LaunchMyWindow(iID) that launches that window.

For a normal LinkButton Control, I could just use
LinkButton.Attributes.Add() in the code-behind Page.OnInit() to add a call
to the javascript function. But:
1) I can't access the LinkButton from OnInit(), because it's inside the
DataList, and
2) (more importantly) the LinkButton needs to get an ID out of the listbox.
I know I could use the ItemCommand on the DataList in the code-behind to
Redirect to the page I want to go to, but I need it to be a popup....

Help?

Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Fabrizio | last post: by
3 posts views Thread by Hardy Wang | last post: by
3 posts views Thread by moondaddy | last post: by
10 posts views Thread by Bharat | last post: by
1 post views Thread by AndrewR | last post: by
3 posts views Thread by Mirek Endys | last post: by
3 posts views Thread by Crazy Cat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.