I am trying to hide a column of UniGrid as needed in code:
Using following XML:
<?xml version="1.0" encoding="utf-8" ?>
<grid>
<columns>
<column source="##ALL##" externalsourcename="FileName" name="FileName " sort=" FileName " caption="Name" wrap="false" width="25%" />
<column source="FileDescription" externalsourcename="FileDescription" name="FileDescription" sort="FileDescription" caption="Description" wrap="true" width="75%" />
</columns>
</grid>
gridFiles.GridName = "~/CMSModules/MyModules/FilesDescr.xml";
gridFiles.NamedColumns["FileDescription"].Visible = false;
Unfortunately I cannot find out why the last row throws and error:
gridFiles.NamedColumns["FileDescription"]' threw an exception of type 'System.Collections.Generic.
KeyNotFoundException' base {System.SystemException}: {"The given key was not present in the dictionary."}
what could be wrong?
Is there a better way to hide some columns which are already set in XML?
Thanks,
Vlado