473,387 Members | 1,669 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

GridView ButtonField RowCommand Image/Button problem

ASP.Net 2.0. I've got a GridView, its got a DataKeyNames set to the ID
of the item that's in a row. I added a ButtonField column, made it a
Button type with my "Remove" text, and when I hit the button, my
CommandArgument in the RowCommand event is my ID field.

Now, when my boss tells me that he wants a little delete picture
instead of the word Remove, I go back, change the ButtonType property
to Image and set the ImageUrl. When I click the image, my RowCommand
event has the row *index* as the CommandArgument, not the ID field as
before.

I can switch back and forth between Button and Image(or Link)
ButtonType to easily replicate this behavior.

Is it supposed to be my DataKeyNames field, or is it supposed to be the
row index?

Nov 23 '05 #1
0 2908

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

28
by: Tim_Mac | last post by:
hi, i'm new to .net 2.0, and am just starting to get to grips with the gridview. my page has autoEventWireUp set to true, which i gather is supposed to figure out which handlers to invoke when...
0
by: googleThis | last post by:
I have a GridView control on a ASP.NET 2.0 page. I load the GridView with a SqlDataReader that gets its data from a stored procedure. Here is how the grid is defined: <asp:GridView...
2
by: luisxx | last post by:
WinSrv2003 SP1 IIS 6.0 ASP.NET C#, 2.0 SQL 2005 All on same machine Hello everyone! I have a method in ASP.NET 2.0 that I can't seem to get right, Gridview1_rowcommand.
0
by: Mike P | last post by:
When you specify updateparameters or deleteparameters for your gridview, I was under the impression that whether or not you write some code in the rowcommand event to deal with this, the update or...
4
by: chris | last post by:
I have a perent gridview which includes in a template field a child gridview. Child gridview includes command buttons for opening different windows based on its row selected. I used the code...
4
by: =?Utf-8?B?Y2hyaXM=?= | last post by:
I have a perent gridview which includes in a template field a child gridview. Child gridview includes command buttons for opening different windows based on its row selected. I used the code...
0
by: mesut | last post by:
hit there, I have a problem getting the rownumbers when I use the template field <asp:button control. I don't get the rownumbers when I use this control. When I use a buttonfield control then I...
3
by: glbdev | last post by:
Hi. I have a gridview in which each row has an image button attached. I have each button in each row set up to be associated with a DB field. When I hover above the button it shows me the...
3
by: Nathan Sokalski | last post by:
I have a GridView with a ButtonField. In the RowCommand I need to use the value of one of the fields used in that row. I am having trouble doing this, so I would appreciate it if someone could help...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.