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

griddataboundgrid, setting cells read only based on their content

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

5 Replies

AD Administrator Syncfusion Team June 14, 2004 04:47 AM

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;


LT Lucas Tijssen June 14, 2004 05:23 AM

>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; >


AD Administrator Syncfusion Team June 14, 2004 05:34 AM

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.


PD Prof DISSOU Jamâl-Dine May 24, 2005 10:30 AM

>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


AD Administrator Syncfusion Team May 24, 2005 12:23 PM

QueryCellStyleInfo.

Loader.
Live Chat Icon For mobile
Up arrow icon