简体   繁体   中英

DevExpress GridControl Double_Click Storing Data

I have a SQL Insert statement that is populating a GridControl (works). I need to make the visibility false for the Primary and Foreign Keys columns. I also want the Double_Click event to populated pre-existing textboxes, and checkboxes, based off of the Primary Key that was selected.

Example:

I have these as columns: PK / FK / source (string) / path (string) / destination (string) / register (checkbox) / register2 (checkbox) / arguments (string)

I need to hide columns 1 & 2. I need to populate the textboxes and checkboxes, when double clicked, based off of the PK and FK.

I can't seem to find the class that grabs the information. I can figure everything else out (I think).

I have looked on the DevExpress site and it's not very helpful. I have tried these things:

https://www.devexpress.com/Support/Center/Question/Details/A2934 https://www.devexpress.com/Support/Center/Question/Details/T156269

How to set the default Sort on a DevExpress GridView

And also trying to create a list based off of the row. That didn't work either. Ideas?

To hide columns, you need to get a handle for the MainView (Assuming you only have a single level of data, ie not a nested master/detail or something).

 GridControl ctl = new GridControl(); // use your existing GridControl instead of creating a new one here
     var view = (GridView) ctl.DefaultView;

Then you can hide either by index, or by name.

view.Columns[0].Visible = false;

OR

view.Columns["PK"].Visible = false;

Then, to get values, is kind of obfuscated (as it seems a lot of the devexpress stuff is). TBy far the easiest way is to databind them, but if that's not possible there are other options available. That part is already answered well here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM