Click here to Skip to main content
15,889,867 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello
I have a Windoes Form Application and a Devexpress GridControl inside it, I need to get the selected row index and for example delete it from my database, How shoud I do it ? GridControl's data has been fetched from SQL database.
Thanks in Advance

What I have tried:

I have tried reading devexpress documents in https://documentation.devexpress.com
for many houres bu I did Not find my answer.
Posted
Updated 20-Oct-17 2:26am

protected void btnEditItem_Click(object sender, EventArgs e)
{
try
{

LinkButton btn = (LinkButton)sender;


var gvr = (DevExpress.Web.ASPxGridView.GridViewDataItemTemplateContainer)btn.NamingContainer;
var trt = gvr.ItemIndex;




}
catch (Exception ex)
{


}
}
 
Share this answer
 
v2
Comments
Richard Deeming 20-Oct-17 10:51am    
This question was asked, answered, and solved over a year ago.

And the question was relating to Windows Forms, not ASP.NET!

Stick to answering recent questions, and make sure you read and understand what's being asked before posting a solution.
I'm a bit rusty on my devexpress but in your gridcontrol i think you should be specifying a grid view. From that grid view, in order to get the Id from an Id column you would do.

C#
devExpressGridView.GetFocusedRowCellValue("Id")


This would assume that your grid's columns contain a column with label of Id. So if your column is labeled Index, then you would switch out Id with Index.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900