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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

griddataboundgrid, setting cells read only based on their content

Thread ID:

Created:

Updated:

Platform:

Replies:

15181 Jun 14,2004 08:40 AM UTC May 24,2005 04:23 PM UTC WinForms 5
loading
Tags: GridControl
Lucas Tijssen
Asked On June 14, 2004 08:40 AM UTC

hello, can somebody help me, I have a gdbg based on a dataview. Based on the contents of a cell I want to set the row to read only kindly regards

Administrator [Syncfusion]
Replied On June 14, 2004 08:47 AM UTC

You should do this in Model.QueryCellInfo. Check out this KB. http://www.syncfusion.com/Support/article.aspx?id=10351 If you want cell 2,2 to be readonly if it holds the string "bad", then you could use this if statement. if(e.RowIndex == 2 && e.ColIndex == 2 && e.Style.Text == "bad") e.Style.ReadOnly = true;

Lucas Tijssen
Replied On June 14, 2004 09:23 AM UTC

>You should do this in Model.QueryCellInfo. Check out this KB. > >http://www.syncfusion.com/Support/article.aspx?id=10351 > >If you want cell 2,2 to be readonly if it holds the string "bad", then you could use this if statement. > ok thank you, but how do I set the row read only ? > >if(e.RowIndex == 2 && e.ColIndex == 2 && e.Style.Text == "bad") >e.Style.ReadOnly = true; >

Administrator [Syncfusion]
Replied On June 14, 2004 09:34 AM UTC

You could use code like this for the if-statement in QueryCellInfo.
if(e.RowIndex == 2 && e.ColIndex > 0)
{
	//set row 2 readonly if col 1 is ''bad''
	string s = (e.ColIndex == 1) ? e.Style.Text : this.grid[e.RowIndex, e.ColIndex].Text;
	if( s == "bad")
     		e.Style.ReadOnly = true;
}
The point is to get the test value from the style object when the text value cell is being requested, but when some other cell is being requested, you get the test value from the grid.

Prof DISSOU Jamâl-Dine
Replied On May 24, 2005 02:30 PM UTC

>You could use code like this for the if-statement in QueryCellInfo. > >
>if(e.RowIndex == 2 && e.ColIndex > 0)
>{
>	//set row 2 readonly if col 1 is ''bad''
>	string s = (e.ColIndex == 1) ? e.Style.Text : this.grid[e.RowIndex, e.ColIndex].Text;
>	if( s == "bad")
>     		e.Style.ReadOnly = true;
>}
>
> >The point is to get the test value from the style object when the text value cell is being requested, but when some other cell is being requested, you get the test value from the grid. What is the equivalent for GridGroupingControl ? Jamâl-Dine DISSOU

Administrator [Syncfusion]
Replied On May 24, 2005 04:23 PM UTC

QueryCellStyleInfo.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;