Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 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 July 16th, 2004, 07:18 AM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 121
Thanks: 0
Thanked 0 Times in 0 Posts
Default OnClick events examples

Hi,

  I have created a simple datagrid. One of the datagrid
  columns holds an asp:button control.

  I have created an OnClick event for this button so that
  when it is clicked - control passes to a simple javascript
  function (client-side).

  My question: can anyone tell me how I can determine which
  asp:button in the datagrid was pressed ?

TIA

 
Old July 18th, 2004, 10:12 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hello,

If you make it a command button, then the event argument is of type DataGridCommandEventArgs. One of the properties is the data grid item that was selected, so you could track down the ID of the datagrid by:

e.item.cells(<id index>).text

If the ID is in a template column control, you do:

ctype(e.item.cells(<id index)).findcontrol(<id>), <control type>).text

Brian
 
Old July 18th, 2004, 03:29 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Are you referring to determining the button on the client side? What do you intend to do with this information in the client side script? (Your answer may determine our answer(s)).
 
Old July 19th, 2004, 05:37 AM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 121
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi again,

what I am ultimately trying to achieve is this:

I have either a bound datagrid or a table that has
repeated fields. This displays a few columns of short
text data. Howver one column, on the end, needs to display
a large text field (like an additional notes field).

I dont want to let it display automatically because it
sizes the whole height of each row really big just to
accomodate the one text field. I thought I could put a command
button in this 'memo' column so that if the reader wishes to
view the additional notes - they can simply click on
the button - the memo text then being popped up and
display in a alert dialog. I would like to make this
a client side event as I thought it would be 'slicker' than
pulling down a whole new page from the server just to
display a pop up?

I can do the client-side button pop up. The last step is
to somehow get the right text into it. I could hold the memo
text in an invisible field within my table. Then if I know
which button fired - I can then pick up the right row's
memo field.

My lack of knowledge is how to pick up table data client-side.
I dont want to keep pestering on about this and appreciate
all your help. Can anyone point to some code examples
that might do anything like the above?

All help much appreciated.

Chas (Canterbury, UK)



 
Old July 20th, 2004, 12:18 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Funny how these threads can get created so chronologically close together...

This thread is a mirror (in idea) to this thread.
 
Old July 21st, 2004, 02:30 AM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 121
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi again,

  I assure that the other thread is no 'collaborator' of mine...

  You are dead right - the theory in the other thread,
  though using C# instead of VB, is exactly the same.
  I will try this also.

Cheers again.









Similar Threads
Thread Thread Starter Forum Replies Last Post
Select Option's onclick,onchange events issue manishk73 Javascript 7 August 29th, 2008 01:20 PM
examples raheleh BOOK: Beginning JavaServer Pages 0 October 2nd, 2007 12:17 AM
examples in Chapter 3 rna5132 JSP Basics 8 October 7th, 2003 11:59 AM





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