Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 26th, 2007, 10:21 PM
Registered User
 
Join Date: Apr 2007
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:)

 
Old December 28th, 2007, 05:24 AM
Authorized User
 
Join Date: Sep 2007
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>
 
Old December 28th, 2007, 05:26 AM
Authorized User
 
Join Date: Sep 2007
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;") %>' ...>





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 10:28 AM
Image Button as Template Field in GridView control vbmazza ASP.NET 2.0 Professional 10 May 27th, 2007 10:03 AM
GridView Control [email protected] Pro Visual Basic 2005 2 March 14th, 2007 10: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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.