Tuesday 15 March 2011

aspxgridview - DevExpress Grid View Error -


I have a problem using the DevExpress component GridView on Visual Studio 2010.

Do I want to be really simple I have a button and when I click on it, I want to show the message like this :. "GridView is the column X value Y on line 0"

The code for the button is very simple:

  protected sub b_test_click (ByVal As the object, ByVal E EventArgs) handle b_test.Click as aux string aux = t_tickets.GetRowValues ​​(0, "numero_de_ticket") toString MsgBox (aux.) End sub   

this The code works perfectly, but it has a strange behavior.

If I select the first line in Gridview then it works fine. But if I select a different line, such as button clicks, I get the following error:

  System.Data.MissingPrimaryKeyException: KeyFieldName found in the property not found under a primary key area Gets the data source. Make sure that the field name is spelled correctly   

I always choose the first row

I think that your problem is not the click function you are trying to send the selected row to the server side unless this line has a key that is a postback.

You should check to see your ASPX file KeyFieldName and check that the data source is the identity field you have declared

  & Lt; Dx:. ASPxGridView runat = "server" id = "t_tickets" KeyFieldName = "id" & gt; ... ... ... & lt; / Dx: ASPxGridView & gt;   

I think you will find that this is wrong in your case. This means that the KeyFieldName that you specify is not a property member of the Data Source related to the grid's line. (Or is not part of the selected statement in the data source)

No comments:

Post a Comment