Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ASP.Net VB to delete row from gridview

Posted on 2011-09-19
2
Medium Priority
?
486 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 4

Accepted Solution

by:
Moizsaif123 earned 2000 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

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 …
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

664 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