18 Answers, 1 is accepted
Currently RadGridView does not support readonly mode on the cell level. You can make an entire column readonly by using its ReadOnly property.
Could you tell us more about the specific scenario you're facing? Do you need a particular cells in a row to be readonly subject to a condition applied to a value in another column of the row?
Best wishes,
Kiril
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
the grid I'm displaying contains data aranged in columns. All columns are readonly, except for one: the value column. Here a user can change the value to his likings. But, it could be that the user doesn't have sufficient rights to change the value in row one, but he does for row two.
So, some cells in one column could be readonly while others are read/write.
As said before, the MS DataGridView does support this feature, maybe a good feature for the RadGridView also.
We have this feature on our ToDo list and will implement it ASAP.
Thank you for the valuable suggestion.
Kind regards,
Dimitar Kapitanov
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Here is a forum link that discusses a similar issue. Check it out and let me know whether it helps.
http://www.telerik.com/community/forums/thread/b311D-hdeta.aspx
Princy.
Thanks
Thank you for the question.
You can make some cell read only when processing the CellBeginEdit event:
void radGridView1_CellBeginEdit(object sender, GridViewCellCancelEventArgs e) |
{ |
if ((int)this.radGridView1.CurrentRow.Cells[2].Value < 10) |
{ |
e.Cancel = true; |
} |
} |
I hope this helps. Should you have any questions, don't hesitate to contact us.
Best wishes,
Jack
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
We decided that the current RadGridView API is enough to control the read only state of grid cells. Just like shown in my previous post you can handle the CellBeginEdit method to make a cell read-only. Nevertheless, if more people request the same feature we will reconsider our decision.
Should you have any other questions, please contact me.
Best wishes,Jack
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Did the CellBeginEdit event help in solving the issue? If not, please describe it in detail and I will try to find a proper solution.
Jack
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
All the best,
Jack
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
I want to make a single cell readonly = false so that it can be edited.
What i want to achieve is something like this. I have three columns, first is CustomerID, second is CustomerAddress, last is Checkbox.
All columns are in readonly.
Whatever user tick on the checkbox, customeraddress must be editable.
I have got the row already but not able to set CustomerAddress to be editable.
My xaml code is shown as below. SilverLight version is 4.
<
telerik:GridViewDataColumn
Header
=
"Customer address"
DataMemberBinding
=
"{Binding CustomerAddress, Mode=TwoWay}"
IsReadOnly
=
"True"
>
<
telerik:GridViewDataColumn.CellTemplate
>
<
DataTemplate
>
<
TextBlock
Text
=
"{Binding CustomerAddress}"
/>
</
DataTemplate
>
</
telerik:GridViewDataColumn.CellTemplate
>
<
telerik:GridViewDataColumn.CellEditTemplate
>
<
DataTemplate
>
<
TextBox
Text
=
"{Binding CustomerAddress, Mode=TwoWay}"
/>
</
DataTemplate
>
</
telerik:GridViewDataColumn.CellEditTemplate
>
</
telerik:GridViewDataColumn
>
My behind code is shown as below.
CheckBox chk = (CheckBox)sender;
GridViewRow row = chk.ParentOfType<
GridViewRow
>();
row.Cells[1].IsReadOnly = False not supported.
I stuck at this for few days already. I have achieved using TextBox instead of TextBlock but the look and feel just not right.
Hence i want it to be displayed in TextBlock and edit in TextBox.
Please let me know the alternative. Thank you very much.
You may use the IsReadOnlyBinding instead of IsReadOnly. For further reference please take a look at this article.
I hope that this is what you need.
Didie
the Telerik team
Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.
In our project we need a particular cells in a row to be readonly subject to a condition applied to a value in another column of the row? Is this possible to do yet?
Best Regards,
Tim
Thank you for writing.
The CellBeginEdit event fires when the cell is about to enter edit mode. You can cancel edit mode (simulate read-only behavior) at this stage by setting the Cancel property to true:
private
void
radGridView1_CellBeginEdit(
object
sender, GridViewCellCancelEventArgs e)
{
if
(e.Column.Name ==
"UnitPrice"
|| e.Column.Name ==
"ProductName"
)
{
rowView = e.Row.DataBoundItem
as
DataRowView;
if
(rowView !=
null
)
{
if
(
int
.TryParse(rowView.Row[
"SupplierID"
] +
""
,
out
id))
{
if
(id == 4)
{
e.Cancel =
true
;
}
}
}
}
}
I hope this information helps. Should you have further questions, I would be glad to help.
Regards,
Desislava
Telerik
I want to make read only for the rad grid cells based on a condition.
Eg: 1 2 3 N/A 5 6 7 N/A
23 34 56 12 N/A 12 10 33
The cells which is having N/A i need to make read only.
I am using radgrid batch edit with GridTemplateColumn. Label in ItemTemplate, RadNumericTextBox in EditItemTemplate.
Regards,
Venkatesh.
Thank you for writing.
I am not sure whether your question is related to RadGridView from the Telerik UI for WinForms suite. However, you can also use the CellBeginEdit event and cancel it if the current cell's value or text is "N/A".
Another approach to simulate read-only behavior is to use the CellFormatting event and set the CellElement.Enabled property to false and the UseDefaultDisabledPaint property to false as well. Thus, the user will not be allowed to edit the specific cell:
private
void
radGridView1_CellFormatting(
object
sender, CellFormattingEventArgs e)
{
if
(e.CellElement.Text !=
null
&& e.CellElement.Text ==
"N/A"
)
{
e.CellElement.Enabled =
false
;
e.CellElement.UseDefaultDisabledPaint =
false
;
}
else
{
e.CellElement.Enabled =
true
;
e.CellElement.UseDefaultDisabledPaint =
true
;
}
}
If your question is related to RadGrid from the Telerik UI for ASP.NET AJAX suite, feel free to post your question in the appropriate forum.
I hope this information helps. Should you have further questions, I would be glad to help.
Regards,
Desislava
Telerik