We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Columns Readonly

Hi,

I am using DGBG, how do I make selected columns readonly.
I do not want to make the entire grid read only.

--Raul


1 Reply

JJ Jisha Joy Syncfusion Team May 1, 2008 09:41 AM UTC


Hi Raul,

Thank you for posting query to us.

This can be achieved by handling the PrepareViewStyleInfo event and conditionally set ReadOnly to specific Columns.

Please refer the code:

this.gridDataBoundGrid1.PrepareViewStyleInfo += new Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventHandler(gridDataBoundGrid1_PrepareViewStyleInfo);


void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs e)
{
if (e.ColIndex == 2 || e.ColIndex == 4)
{
e.Style.ReadOnly = true;
}
}

Regards,
Jisha


Loader.
Live Chat Icon For mobile
Up arrow icon