Solved

ASP.Net VB to delete row from gridview

Posted on 2011-09-19
2
470 Views
Last Modified: 2012-06-21
Hi

I have a page with a dynamically created grid view.  I have added AutoGenerateDeleteButton = true and AddHandler myGridview.RowDeleting, AddressOf Me.gvrowdel

The problem I have is I cant figure out how to reference the datakeynames value for the row that was clicked to delete the correct line in my sql.

If it was a GridViewCommandEventArgs I would use something like the below:
(GridView1.DataKeys(Convert.ToInt32(e.CommandArgument)).Value)
However this is not a part of the GridViewDeleteEventArgs.

There is the e.rowindex which returns the row I clicked but I'm unsure how to use this to get the value of cell(1) (which is my ID/datakeys value)

Can any one help.

Thanks

Brasso






0
Comment
Question by:brasso_42
2 Comments
 
LVL 4

Accepted Solution

by:
Moizsaif123 earned 500 total points
ID: 36561653
try this,
GridView1.Rows(e.RowIndex).Cells(0).Text


there is more information on this regarding the rowdeleting event

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowdeleting.aspx
0
 
LVL 1

Author Closing Comment

by:brasso_42
ID: 36565741
Awsome thanks
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now