Making a raddataform field readonly programmlly without disabling it

4 posts, 0 answers
  1. ابو
    ابو avatar
    15 posts
    Member since:
    Oct 2015

    Posted 20 Nov 2016 Link to this post

    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

  2. Stefan X1
    Admin
    Stefan X1 avatar
    665 posts

    Posted 23 Nov 2016 Link to this post

    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.
  3. ابو
    ابو avatar
    15 posts
    Member since:
    Oct 2015

    Posted 24 Nov 2016 in reply to Stefan X1 Link to this post

    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

  4. Stefan X1
    Admin
    Stefan X1 avatar
    665 posts

    Posted 25 Nov 2016 Link to this post

    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.
Back to Top