c# - WSS3 - setting a default value on a SPFieldType.Boolean after creation -
i'm using wss3 , c# create site , creating class change fields on lists after have been created. have created spfield.boolean type no default value, after upgrade need default value set true. current code not work follows:
//web defined current web var list = web.site.rootweb.lists["listwithfieldonit"]; var field = list.fields.getfield("booleanfield"); field.defaultvalue = "1"; field.update(true); list.update(true);
i have tried change default value through sharepoint instance , sharepoint manager 2007 , neither of have worked. know of way set default value or doing wrong?
thanks in advance
code below should more enough update list field definition:
var list = web.site.rootweb.lists["listwithfieldonit"]; var field = list.fields.getfield("booleanfield"); field.defaultvalue = "1"; field.update();
you don't need update list or pass 'true' spfield.update method.
Comments
Post a Comment