HighTechTalks DotNet Forums  

using buttons in a gridview

ASP.net Data Grid Control microsoft.public.dotnet.framework.aspnet.datagridcontrol


Discuss using buttons in a gridview in the ASP.net Data Grid Control forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
eagle
 
Posts: n/a

Default using buttons in a gridview - 07-09-2007 , 02:21 PM






In the following article, it says to have a button ina gridview, you need
to capture the ItemCommand event. Well, there is no ItemCommand event in
the gridview. So I use the RowCommand. The Article says to use the
e.item.itemindex to determine the row that was selected, well the RowCommand
has no e.item.itemindex proeprty. So how am I supposed to put a button in a
gridview.

http://msdn2.microsoft.com/en-us/lib...3s(vs.80).aspx



Reply With Quote
  #2  
Old   
martin marinov
 
Posts: n/a

Default Re: using buttons in a gridview - 07-10-2007 , 03:23 AM






Hello eagle,

Quote:
In the following article, it says to have a button ina gridview, you
need to capture the ItemCommand event. Well, there is no ItemCommand
event in the gridview. So I use the RowCommand. The Article says to
use the e.item.itemindex to determine the row that was selected, well
the RowCommand has no e.item.itemindex proeprty. So how am I supposed
to put a button in a gridview.

http://msdn2.microsoft.com/en-us/lib...3s(vs.80).aspx


Yes you are correct that in the GridViewCommandEventArgs class there is no
index of the row. Fo this purpose you can follow the sample of this article
that describes how you can handle the index of the row:
http://msdn2.microsoft.com/en-us/lib...owcommand.aspx

Regards
Martin




Reply With Quote
  #3  
Old   
eagle
 
Posts: n/a

Default Re: using buttons in a gridview - 07-12-2007 , 08:45 AM



Thanks! That works!

"martin marinov" <mmarinov (AT) developer (DOT) bg> wrote

Quote:
Hello eagle,

In the following article, it says to have a button ina gridview, you
need to capture the ItemCommand event. Well, there is no ItemCommand
event in the gridview. So I use the RowCommand. The Article says to
use the e.item.itemindex to determine the row that was selected, well
the RowCommand has no e.item.itemindex proeprty. So how am I supposed
to put a button in a gridview.

http://msdn2.microsoft.com/en-us/lib...3s(vs.80).aspx



Yes you are correct that in the GridViewCommandEventArgs class there is no
index of the row. Fo this purpose you can follow the sample of this
article that describes how you can handle the index of the row:
http://msdn2.microsoft.com/en-us/lib...owcommand.aspx

Regards
Martin





Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.