web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

disable/enable a field in server side via c#

(0) ShareShare
ReportReport
Posted on by 225
In MS CRM, did anybody know how to disable/enable a field in a page in server side? I know how to do it in client side via javascript. But I wish to get a solution to do it in server side via c#. Thanks in advance.

*This post is locked for comments

I have the same question (0)
  • a33ik Profile Picture
    84,331 Most Valuable Professional on at
    Re: disable/enable a field in server side via c#

     Hi, Brett.

     Read SDK more attentive. Оn Server Side you can do only three types of actions, connected with development - plugins, custom workflows and custom web pages.

     So it seems that enabling/disabling fields on server side is not supported customization.

  • Yaniv Arditi Profile Picture
    3,990 on at
    Re: disable/enable a field in server side via c#

    Hi,

    Try working with a plug-in component mapped to the post-retrieve message.

    Hope this helps,

    Yaniv Arditi

    http://blogs.microsoft.co.il/blogs/rdt/

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at
    Re: Re: disable/enable a field in server side via c#

     Hi, Yaniv.

     Such approach will give the posibility to change values of fields in resultset but not to disable fields on form.

  • brett hu Profile Picture
    225 on at
    Re: Re: disable/enable a field in server side via c#

     "Try working with a plug-in component mapped to the post-retrieve message." It seems that we can use this way to do validation. But to prevent user changing value at beginning, I still prefer to disable the field. Unfortunately as  a33ik said, I can not find a way to do it in server side.

    Thank you and a33ik's reply. 

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at
    Re: Re: Re: disable/enable a field in server side via c#

     Hi. To disable fields use client side JavaScript.

  • brett hu Profile Picture
    225 on at
    Re: Re: Re: Re: disable/enable a field in server side via c#

     Hi, thank you for your reply. However to do it via javascript, it is not safe. I have to add lots of validaiton via plugin which cause another problem --- hard to maintain. Since one change, I have to modify both javascript and plugin.

    And for different browser, javascript's behavior  may be different. We wish to disable/remove a field in server so we can maintain it easier.

    Thanks anyway.

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at
    Re: Re: Re: Re: Re: disable/enable a field in server side via c#

     Don't worry. There are only one supported browser for Microsoft Dynamics CRM - IE =)

  • brett hu Profile Picture
    225 on at
    Re: Re: Re: Re: Re: Re: disable/enable a field in server side via c#

    :-) thanks

  • brett hu Profile Picture
    225 on at
    Re: Re: Re: Re: Re: Re: Re: disable/enable a field in server side via c#

    Again, did anybody know how to disable/enable a field in a page in server side? Thanks in advance

  • Community Member Profile Picture
    on at
    Re: disable/enable a field in server side via c#

    Option 1: (Supported is debatable but probably not supported)

    While it is not server side code, it is .Net code instead of Javascript if you use SilverLight.  You can add a Silverlight control to a page via an IFrame and modify the contents of the page.  See Links.

     Links:

    http://blog.arash.cc/post/Adding-client-side-business-logic-to-CRM-forms-using-Silverlight-managed-code.aspx

    http://blogs.msdn.com/crm/archive/2007/06/19/crm-and-silverlight-integration.aspx

     

    Option 2:  (Completely Unsupported )

    Disabling the Fields from the Server side is incredibly unsupported, but in theory could be done by creating your own class that extends of of the Crm Web Form Page and override the page.  For example, to control the contacts edit form from the server side, Create a class that extends Microsoft.Crm.Web.SFA.ContactDetailPage.  You will have to use .Net reflector to figure out which methods to override. Modify the controls as desired.   Then open CRMWeb\SFA\conts\edit.aspx and replace the inherits with your class.

    Again this would be an unsupported hack that will probably break on the first update (Rollup) you apply. 

    *All info provided as is and i take no responsibility if you break Crm.

    Happy Hacking,

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#1
UllrSki Profile Picture

UllrSki 2

#3
ED-30091530-0 Profile Picture

ED-30091530-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans