Follow up to selecting a SalesLogix gridview Row ID

In my previous post, I mentioned how to get the selected ID of a gridview’s row when you click the row.  Since then I have found that sometimes SalesLogix will implement an extra DataKey in the grid when it is deployed as a quick form.  (For instance, if you specify the grid’s DataKeyNames = “Id”, when it deploys you will actually see the grids DataKeyNames are “InstanceId, Id” When you call the code I had mentioned before:

string noteId = grdSystemNotes.SelectedDataKey.Value.ToString();

The system would actually return the InstanceId DataKey since that is the first specified.  The InstanceId is a GUID based Id for the rendered HTML grid and does no good for us wanting to get the row’s ID.  The more sure-fire way of getting our desired DataKey “Id” is by using code like this:

string noteId = grdSystemNotes.DataKeys[grdSystemNotes.SelectedIndex].Values["Id"].ToString();
ABOUT THE AUTHOR

Kris Halsrud

Kris Halsrud is a Senior Analyst / Developer for Customer FX Corporation.

2 Comments

  1. thanks this help me not to create customize smartpart.

    Reply
  2. This post changed my life. Well, at least it changed my day. Thanks.

    Reply

Submit a Comment

Your email address will not be published.

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) and Creatio (bpm'online) news and product updates!

You have Successfully Subscribed!