Can use a variable for the ControlMode property?
-
Friday, June 15, 2012 5:26 AM
Hello
i have a question.
i want to set a variable for "ControlMode" property of the control to handle its display status.
Could do this?
Thanks in advance!
All Replies
-
Friday, June 15, 2012 6:09 AM
yes you can set the controlmode follow the link provided below for details
Best Regards, Ashutosh | SharePoint World
-
Friday, June 15, 2012 6:55 AM
Thanks for your reply!
but this link seems not mention my question.just introduced the usage of "ControlMode".
maybe i have no clearly describe my request.
the effect i desired like the following code:
String s;
s = "Edit"
<Sharepoint:FormField ... ControlMode=s ... >
-
Friday, June 15, 2012 9:24 AM
ControlMode is an enum property of the "FormField" class in the Microsoft.SharePoint.WebControls namespace.
hence you can not use string variable to assign the value ControlMode you can take help from following post to create enum type variable
http://www.dotnetperls.com/enum-tostring
Best Regards, Ashutosh | SharePoint World
-
Monday, June 18, 2012 4:51 AM
If the "ControlMode" is an enum property , why can give a string as its value? liks this: ControlMode="New".
As you said, then i can not use any variable to assign the value for "ControlMode" ?
-
Monday, June 18, 2012 9:23 AM
you can use variable of type SPControlMode to assign the value for "ControlMode"Best Regards, Ashutosh | SharePoint World
- Marked As Answer by Linsen4624 Monday, June 18, 2012 9:38 AM
-
Monday, June 18, 2012 9:37 AM
Thank you very much!

