Hi all!
I added a new field to the custom list (custlist) by adding the following entry to the schema.xml:
I set hidden=true because I need this field completly hidden to the UI. But when I try to set or get the value in this field I get an error (Object reference not set to an instance of an object).
Here is the part of my source code:
If I try this code with the "title" field of the custom list or if I set hidden=false then it works. Does anybody know how to get this work?
I added a new field to the custom list (custlist) by adding the following entry to the schema.xml:
Code:
<Field Type="Integer" Name="State" DisplayName="State" Sealed="TRUE" Hidden="TRUE" ReadOnly="FALSE"/>
I set hidden=true because I need this field completly hidden to the UI. But when I try to set or get the value in this field I get an error (Object reference not set to an instance of an object).
Here is the part of my source code:
Code:
SPWeb myweb = SPControl.GetContextWeb(Context);
myweb.AllowUnsafeUpdates = true;
SPList list = myweb.Lists[[i]"List_name"[/i]];
list.Items[0]["State"] = 1; //an item with index 0 exits!!!
list.Items[0].Update();
output.Write(list.Items[0]["State"].ToString()); //this statement causes the error
If I try this code with the "title" field of the custom list or if I set hidden=false then it works. Does anybody know how to get this work?