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

Making a raddataform field readonly programmlly without disabling it

3 Answers 218 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
ابو
Top achievements
Rank 1
ابو asked on 20 Nov 2016, 05:58 PM

hi

I have raddataform with fields

empid

name

salary

I wanna to Making a raddataform field (empid) read-only  programmlly without disabling it, 

programmlly in c# code  not xaml

3 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 23 Nov 2016, 11:30 AM
Hello,

Can you please take a look at the Making a form readonly without disabling it? forum thread, as this topic is discussed in detail in it?

Hopefully, it helps.

Best Regards,
Stefan X1
Telerik by Progress
Telerik UI for WPF is ready for Visual Studio 2017 RC! Learn more.
0
ابو
Top achievements
Rank 1
answered on 24 Nov 2016, 08:46 AM

ok ... that's not what I want

I need the filed 'EmpId' in raddataform edit mode readonly not editable programmlly in c# code  not XAML

like image

plz help me quickly

0
Stefan
Telerik team
answered on 25 Nov 2016, 04:43 PM
Hello,

Thanks for the update.

If I am understanding your requirement correctly, you can benefit from the AutoGeneratingField event of RadDataForm. The event handler arguments provide the DataField property. You should be able to set its IsEnabled property to False as follows.
private void DataForm2_AutoGeneratingField(object sender,
    Telerik.Windows.Controls.Data.DataForm.AutoGeneratingFieldEventArgs e)
{
    if (e.PropertyName == "Name")
    {
        e.DataField.IsEnabled = false;
    }
}

Can you please give the approach a try? Is this the behavior you are trying to attain?

Best Regards,
Stefan X1
Telerik by Progress
Telerik UI for WPF is ready for Visual Studio 2017 RC! Learn more.
Tags
DataForm
Asked by
ابو
Top achievements
Rank 1
Answers by
Stefan
Telerik team
ابو
Top achievements
Rank 1
Share this question
or