This is a migrated thread and some comments may be shown as answers.

How-to make readonly colum visible in editform

7 Answers 221 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Syed
Top achievements
Rank 1
Syed asked on 07 Nov 2013, 08:58 PM

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

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 08 Nov 2013, 03:57 AM
Hi Syed,

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
0
Syed
Top achievements
Rank 1
answered on 10 Nov 2013, 07:56 PM

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

0
Syed
Top achievements
Rank 1
answered on 12 Nov 2013, 10:48 PM

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

0
Viktor Tachev
Telerik team
answered on 13 Nov 2013, 04:19 PM
Hello Syed,

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
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Princy
Top achievements
Rank 2
answered on 14 Nov 2013, 09:09 AM
Hi Syed,

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
0
Syed
Top achievements
Rank 1
answered on 07 Feb 2014, 04:12 AM


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

0
Princy
Top achievements
Rank 2
answered on 07 Feb 2014, 05:53 AM
Hi Syed,

I have answered to your post here. Please try and let me know and reply there for further clarifications.

Thanks,
Princy
Tags
Grid
Asked by
Syed
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Syed
Top achievements
Rank 1
Viktor Tachev
Telerik team
Share this question
or