473,388 Members | 1,399 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,388 software developers and data experts.

Gridview Customised Delete action

Hi,

I'm having a GridView with Datasource being set from CodeBehind method, its
has a "RecID" databound field set as invisible.

I want to utilize the "Delete" commandfield, so that on gridview_RowDeleting
event, i can perform a customised delete action.

I've tried me.gridview.Rows(e.RowIndex).Cells(intField).Text, which only
works for "visible" field

My problem is now on such RowDeleting Event, I don't know how to access such
invisible "RecID" databound field, can anyone tell me what should i do for
achieving such field's value?


Mar 22 '06 #1
3 4463
A GridView doesn't count invisible columns as real columns... so you
have to go directly to the data.

When in debug mode, set a breakpoint in the RowDataBound method (which
yuo assigned to that event).

Look for something like the following
(string)((DataRowView)e.Row.DataItem)[1]

This will get you the information in that column...

Mar 22 '06 #2
Thanks, I have just found another way to retrieve that invisible column,
because its my Data Key of the record, so I set the "DataKeyNames" attribute
of the GridView

then on the RowDeleting event, i can use following syntax to retrieve it!
Me.gvMaterialPO.DataKeys.Item(e.RowIndex).Value
<ag******@gmail.com> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.com...
A GridView doesn't count invisible columns as real columns... so you
have to go directly to the data.

When in debug mode, set a breakpoint in the RowDataBound method (which
yuo assigned to that event).

Look for something like the following
(string)((DataRowView)e.Row.DataItem)[1]

This will get you the information in that column...

Mar 22 '06 #3
Yeah that'll work too... point is that you can't just access the
column. You have to do it via data.

Mar 22 '06 #4

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

Similar topics

2
by: Robert Smith jr. | last post by:
Hello, Please pardon my newbie question ... I am building an ASP.NET page that displays a recordset with a Delete statement enabled (this all works fine). I want to Insert the current row...
3
by: NateDawg | last post by:
I'm reposting this. I'm kinda in a bind untill i get this figured out, so if anyone has some input it would sure help me out. Ok, I’ve noticed a few gridview problems floating around the forum....
3
by: Simon Strandgaard | last post by:
Hi group, my setup: I have a GridView that extracts data from my table (a SqlDataSource). For each row, I have an 'edit' button and a 'delete' button. The 'edit' button opens a popup, through...
2
by: NH | last post by:
Is it possible to create a gridview control that allows scrolling on the columns. I have a gridview with a list of people names in the first column and the rest of the columns are week dates...
0
by: =?Utf-8?B?cGI2NDgxNzQ=?= | last post by:
We have been having this problem for months and always assumed it was because of our somewhat complicated setup. I have just spent almost all of today making this into a simple example that can be...
2
by: TeamN2 | last post by:
I am having an issue creating a column in a GridView control using c#. when the user clicks the delete link i want the logic to delete the database record and also an associated file. thusly i...
3
by: Nathan Sokalski | last post by:
I have a GridView control with three columns, all BoundField columns. They all have a HeaderText and DataField property set, and the third one has a DataFormatString property as well. When I run my...
1
by: Leon Mayne | last post by:
Hello, I have a gridview that's bound to a generic list of business objects and am using the RowCommand event to capture user clicks on actions. This was working fine up until today, but now...
5
by: sandhyascs | last post by:
Hi everyone I’m using the GridView in asp.net and populating the grid dynamically using c#.net.To edit the rows i i m using GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)....
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,...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.