Hello All
When you select a column in RadGrid as "read only" it will be hidden in Edit and Insert mode, I have a requirement to show it, but I don’t know how to do this with Ajax RadGrid? If I put the EditMode="InPlace"
It appear as label which is good but I wanted to use the EditMode="EditForms"
It I Use this it disappears, Can someone please update me how to resolve this issue. I don’t not want to use template column that will increase huge work on my end
Thanks in advance
Syed Qazafi
7 Answers, 1 is accepted
You do not have to set the column to readonly. In editmode you can change the control of TextBox to a Label. Please try the following code snippet.
ASPX:
<telerik:GridBoundColumn UniqueName="OrderID" DataField="OrderID" HeaderText="OrderID" ReadOnly="false" />C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e){ if (e.Item is GridEditableItem && e.Item.IsInEditMode) { GridEditableItem edit = (GridEditableItem)e.Item; TextBox txtboxID = edit["OrderID"].Controls[0] as TextBox; txtboxID.Visible = false; string val=txtboxID.Text; Label lbl = new Label(); lbl.Text = val; lbl.ID = "lnkID"; txtboxID.Parent.Controls.AddAt(1,lbl); }}Thanks,
Princy
Hi Princy
Thanks for your and I really appreciate that. It works but if I have four five control on every grid which I need to display like this(I have around 20 grids at least)then it will increase work for me. I am looking for similar functionality like when we use EditMode="InPlace", however If that is only choice then I have to stick with this. I think Telerik need to consider this for their future releases
Many thanks
Syed Qazafi Anjum
Hi There
I am marking this as an answer but I would like someone from Telerik to respond whether they would like to consider this as built-in function in their next release, It will save lot of time for developer.
Thanks
Syed Qazafi
Thank you for the suggestion.
The mentioned functionality is not added in our tasks planning for the upcoming release however
you could add this feature as a request in our feedback portal here so users can vote for it. When the request gathers enough votes its priority for will be increased and it could be included in the features planning for future releases.
Currently the solution you could use is the one suggested by Princy.
Regards,
Viktor Tachev
Telerik
Another solution is to disable the TextBox of the required column in EditMode . Since you have many grids, you can optmise the code as below.
C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e){ if (e.Item is GridEditableItem && e.Item.IsInEditMode) { (e.Item as GridEditableItem)["UniqueColumnName"].Enabled = false; }}Thanks,
Princy
Hi Princy
I have a requirement where I would like to bind my telerik:GridDropDownColumn to two
different data source based on Edit and Insert mode.
For example if I am inserting a record I would like to
bind my telerik:GridDropDownColumn
to a data source Name “Insertdatasource” and if it is in edit/update mode I
would like to bind the same telerik:GridDropDownColumn
to “Updatedatasource”.
The reason why I would like to do this as I do not want
to show the option which my user have already inserted inside my grid. When he
insert new row only those option will appear which are not already inserted.
I hope you understand my problem.
I look forward for your response soon
Thanks in advance
Syed Qazafi
