Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > How to determine which cell was clicked in as ASP.NET DataGrid

Reply
Thread Tools

How to determine which cell was clicked in as ASP.NET DataGrid

 
 
Daniel Walzenbach
Guest
Posts: n/a
 
      06-01-2004
Hi,



I created an ASP.NET Datagrid where a single row can be selected by clicking anywhere on the row (according to http://msdn.microsoft.com/library/de...verControl.asp, Selecting Rows by Clicking Anywhere).



Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, _
ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) _
Handles DataGrid1.ItemDataBound
Dim itemType As ListItemType = e.Item.ItemType
If ((itemType = ListItemType.Pager) Or _
(itemType = ListItemType.Header) Or _
(itemType = ListItemType.Footer)) Then
Return
Else
Dim button As LinkButton = _
CType(e.Item.Cells(0).Controls(0), LinkButton)
e.Item.Attributes("onclick") = _
Page.GetPostBackClientHyperlink(button, "")
End If
End Sub

Additionally I want to be able to know which cell was clicked. Does anybody know how this can be done?



Thank you a lot in advance!



Daniel


 
Reply With Quote
 
 
 
 
John Saunders
Guest
Posts: n/a
 
      06-02-2004
"Daniel Walzenbach" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
Hi,



I created an ASP.NET Datagrid where a single row can be selected by clicking anywhere on the row (according to http://msdn.microsoft.com/library/de...verControl.asp, Selecting Rows by Clicking Anywhere).



Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, _
ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) _
Handles DataGrid1.ItemDataBound
Dim itemType As ListItemType = e.Item.ItemType
If ((itemType = ListItemType.Pager) Or _
(itemType = ListItemType.Header) Or _
(itemType = ListItemType.Footer)) Then
Return
Else
Dim button As LinkButton = _
CType(e.Item.Cells(0).Controls(0), LinkButton)
e.Item.Attributes("onclick") = _
Page.GetPostBackClientHyperlink(button, "")
End If
End Sub

Additionally I want to be able to know which cell was clicked. Does anybody know how this can be done?



Thank you a lot in advance!




I'm not certain, but I think that if you use something other than "" for the second parameter to GetPostBackClientHyperlink, then the parameter will be passed as Request.Form("__EVENTARGUMENT").
--
John Saunders
johnwsaundersiii at hotmail


 
Reply With Quote
 
 
 
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      06-02-2004
Hi Daniel,

I'm viewing this post and find it is a duplicated one with another thread
with same title in
Newsgroups: microsoft.public.dotnet.framework.aspnet

I've posted a reply and provided my suggestoins in that one. I'd appreciate
if you'd have a look there. Also, if you feel it convenient that we
continue to discuss in that thread, please feel free to followup there.
Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

 
Reply With Quote
 
SoftLion
Guest
Posts: n/a
 
      06-03-2004
Could you copy-paste here please ?

"Steven Cheng[MSFT]" <(E-Mail Removed)> a écrit dans le message
de news:(E-Mail Removed)...
> Hi Daniel,
>
> I'm viewing this post and find it is a duplicated one with another thread
> with same title in
> Newsgroups: microsoft.public.dotnet.framework.aspnet
>
> I've posted a reply and provided my suggestoins in that one. I'd

appreciate
> if you'd have a look there. Also, if you feel it convenient that we
> continue to discuss in that thread, please feel free to followup there.
> Thanks.
>
> Regards,
>
> Steven Cheng
> Microsoft Online Support
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
> Get Preview at ASP.NET whidbey
> http://msdn.microsoft.com/asp.net/whidbey/default.aspx
>



 
Reply With Quote
 
Daniel Walzenbach
Guest
Posts: n/a
 
      06-03-2004
Steven,

thanks for your help! I tried what you posted and it worked perfectly well.
I'll implement your suggestion in a couple of days. Thank you!

Daniel


"Steven Cheng[MSFT]" <(E-Mail Removed)> schrieb im Newsbeitrag
news:(E-Mail Removed)...
> Hi Daniel,
>
> I'm viewing this post and find it is a duplicated one with another thread
> with same title in
> Newsgroups: microsoft.public.dotnet.framework.aspnet
>
> I've posted a reply and provided my suggestoins in that one. I'd

appreciate
> if you'd have a look there. Also, if you feel it convenient that we
> continue to discuss in that thread, please feel free to followup there.
> Thanks.
>
> Regards,
>
> Steven Cheng
> Microsoft Online Support
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
> Get Preview at ASP.NET whidbey
> http://msdn.microsoft.com/asp.net/whidbey/default.aspx
>



 
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
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
determine which submit input is clicked, get syntax error css-discuss.org Javascript 6 01-15-2012 11:01 PM
how do I determine which button is clicked with HTML control? Samuel ASP .Net Web Controls 6 07-28-2005 08:36 AM
How to determine which cell was clicked in as ASP.NET DataGrid Daniel Walzenbach ASP .Net 2 06-02-2004 06:48 AM
How to determine which control in a template column was clicked... Jim Mitchell ASP .Net Datagrid Control 2 10-29-2003 12:09 PM



Advertisments