Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > DataList [Edit Item Template] LinkButton call Javascript to open new window

Reply
Thread Tools

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

 
 
Nevyn Twyll
Guest
Posts: n/a
 
      08-16-2003
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?


 
Reply With Quote
 
 
 
 
S. Justin Gengo
Guest
Posts: n/a
 
      08-16-2003
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" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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?
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Open New Window from DataList Item... =?Utf-8?B?SnVsZXNfQW5pbWU=?= ASP .Net 2 11-22-2005 12:57 PM
Linkbutton does not look like a linkbutton Sathyaish ASP .Net 3 09-08-2005 09:41 AM
Linkbutton does not look like a linkbutton Sathyaish ASP .Net Datagrid Control 1 09-08-2005 08:44 AM
Setting up a datalist control - Item_DataBound for a datalist in a datalist Nevyn Twyll ASP .Net 8 09-09-2004 10:13 PM
DataList [Edit Item Template] LinkButton call Javascript to open new window Nevyn Twyll ASP .Net Web Controls 1 08-16-2003 01:56 AM



Advertisments