Questions tagged [rowcommand]

Use RowCommand event if you have problem related Button like controls)'s click event inside asp:GridView.

The RowCommand event is raised when a button is clicked in the GridView control. This enables you to provide an event-handling method that performs a custom routine whenever this event occurs.

Buttons within a GridView control can also invoke some of the built-in functionality of the control. To perform one of these operations, set the CommandName property of a button to one of the values in the following table.

Syntax: public event GridViewCommandEventHandler RowCommand

See usage example here.

102 questions
52
votes
5 answers

Get DataKey values in GridView RowCommand

I have a GridView with an associated DataKey, which is the item ID. How do I retrieve that value inside the RowCommand event? This seems to work, but I don't like the cast to LinkButton (what if some other command is firing the event?), and I'm not…
Farinha
  • 16,296
  • 21
  • 61
  • 79
32
votes
6 answers

Get Row Index on Asp.net Rowcommand event

I have an asp.net GridView:
Shahin
  • 11,703
  • 37
  • 120
  • 199
9
votes
4 answers

Get data from RowCommand

I have a grid which shows product versions and have a few link buttons like edit, delete, preview etc. On click of the edit button I want to get the Product ID and Version ID and redirect to some xyz.aspx page where the product details can be…
Sayed
  • 125
  • 1
  • 1
  • 9
8
votes
2 answers

Gridview RowCommand event with DropDownList is not working

I have created a few DropDownLists that get populated with data from a database. The first lines of the Dropdownlists are ListItem:
Nils
  • 444
  • 3
  • 8
  • 22
7
votes
2 answers

Rowcommand do not fire after clicking button

I have already find out the solution, i just want to post it so this may be useful for some people This is the button that use command
Sarawut Positwinyu
  • 4,544
  • 13
  • 47
  • 71
6
votes
8 answers

Retrieve data from visible false BoundField of Gridview

I have this BoundField in a GridView But when I try to get text in that field, it returns empty. protected void gvwReports_RowCommand(object sender, GridViewCommandEventArgs…
Darshana
  • 2,366
  • 6
  • 25
  • 49
5
votes
2 answers

ASP.NET GridView RowCommand TextBox empty

Hi I have a grid view with a textbox in each row that im trying to get the value of in the RowCommand event. The below code works fine for all rows expect the first one. The textbox.text value for the first row in always empty.
user346443
  • 4,338
  • 13
  • 53
  • 75
5
votes
2 answers

In gridview how to use rowcommand event for a button

I am using a gridview in aspx and i have two pages that registration and details.aspx once registration completed it should goto details page in details.aspx i have kept a gridview in that GV i am supposed be use row command event for a button it…
Samaritan_Learner
  • 547
  • 1
  • 4
  • 22
4
votes
1 answer

How to send multiple command arguments through command button ?(RowCommand Event)

I'm Trying to send accross multiple command arguments when a rowcommand is called:
Pavitar
  • 3,912
  • 9
  • 44
  • 78
4
votes
3 answers

GridView_RowCommand event fired again on page refresh

I have implement GridView Row Editing feature in my .net application using
Sukhjeevan
  • 3,288
  • 7
  • 41
  • 84
3
votes
2 answers

Fire a RowCommand event from ImageButton created dynamically inside ITemplate

I have a dynamically created GirdView based on value of a DropDownList. I use the ITemplate interface to generate the fields: public class CreateItemTemplateOrder : ITemplate { ImageButton imgbtn_up; ImageButton imgbtn_down; string…
Simone Foschi
  • 41
  • 2
  • 6
3
votes
1 answer

Gridview RowCommand event is fired when I do sorting in gridview

I am trapped in some abnormal problem. When I do sorting in gridview, it fires RowCommand event for that grid instead of sorting event. Below is the HTML code for my grid view.
Microsoft Developer
  • 4,393
  • 20
  • 87
  • 136
2
votes
3 answers

Confirmation box for LinkButton in Gridview before Rowcommand fires

I have a gridview, and a linkbutton on this gridview. When linkbutton is clicked, rowCommand fires, however I want to ask user to comfirm the click with a comfirmation box, if yes -> rowCommand fires, if no-> nothing happens. I couldn't find a…
HOY
  • 1,187
  • 9
  • 40
  • 74
2
votes
2 answers

ViewState for private string with button

I have gridview with a Rowcommand event that let's me get the column ActivityID cell value and puts it in a private string called ActivityIDString. private string ActivityIDString; // To be used in btUpdate protected void…
Nils
  • 444
  • 3
  • 8
  • 22
2
votes
1 answer

RowCommand in GridView raises multiple events on click

A nice good afternoon from Germany, I have a asp:GridView and ButtonFields on the row with a RowCommand event. protected void gridView_RowCommand(object sender, GridViewCommandEventArgs e) { switch (e.CommandName) { case…
marcjohne
  • 141
  • 2
  • 9
1
2 3 4 5 6 7