Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old December 26th, 2007, 10:21 PM
Registered User
 
Join Date: Apr 2007
Location: , , Philippines.
Posts: 9
Thanks: 0
Thanked 1 Time in 1 Post
Default How to put a button control in a GridView control

Hi everyone!

How can i place a button control in a grid view control(ASP.net2.0)?
and how can i call a script using that button?

my simple script function i wish to call:

<script language="javascript" type="text/javascript">
   function popUpWindow(){
      window.open([...],[...],[...])
   }
</script>

thanks in advance!

~ryan.webb:)

Reply With Quote
  #2 (permalink)  
Old December 28th, 2007, 05:24 AM
Authorized User
 
Join Date: Sep 2007
Location: , , Finland.
Posts: 92
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Did you already solve this problem? But anyway, TemplateField is your friend:

Code:
<asp:GridView ...>
  <Columns>
    <TemplateField ...>
      <ItemTemplate>
        <asp:Button runat="Server" Text="Foo" OnClickClick="popUpWindow(); return false;" ...>
      </ItemTemplate>
    </TemplateField>
    ...
  </Columns>
</asp:GridView>
Reply With Quote
  #3 (permalink)  
Old December 28th, 2007, 05:26 AM
Authorized User
 
Join Date: Sep 2007
Location: , , Finland.
Posts: 92
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Oh. You asked about how to send parameters to popup window on asp.net 2.0 pro forum. Here's an example for that:

Code:
<script language="javascript" type="text/javascript">
   function popUpWindow(id){
      window.open('popup.aspx?id=' + id,[...],[...])
   }
</script>

<asp:Button runat="Server" Text="Foo" OnClientClick='<%# Eval("ID", "popUpWindow({0}); return false;") %>' ...>
Reply With Quote
Reply


Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
using gridview control, how to update? aaronabdiel ASP.NET 2.0 Basics 2 February 13th, 2008 08:41 AM
User Control in a GridView Colonel Angus ASP.NET 2.0 Basics 4 August 13th, 2007 11:28 AM
Image Button as Template Field in GridView control vbmazza ASP.NET 2.0 Professional 10 May 27th, 2007 11:03 AM
GridView Control jmyers@smurfit.com Pro Visual Basic 2005 2 March 14th, 2007 11:57 PM
How to put a control inside a table cell? zach2004 ASP.NET 1.x and 2.0 Application Design 7 March 8th, 2004 03:28 PM



All times are GMT -4. The time now is 06:08 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.