Feb 07, 2014, 7:05 AM
Ext.Net.Tags is not marked as serializable.
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" ShowWarningOnAjaxFailure="true" />
<ext:Viewport ID="pnlEditor" runat="server" Frame="true" Layout="BorderLayout">
<Items>
<ext:Panel ID="pnlTags" runat="server" Region="Center">
<Items>
<ext:TagField
ID="Tags1"
runat="server"
Width="500"
TypeAhead="true"
EmptyText="[Add tags]" >
<Items>
<ext:Tag Value="1" Text="Jack" Icon="User" />
<ext:Tag Value="2" Text="Bob" Icon="UserAdd" />
<ext:Tag Value="3" Text="John" Icon="UserAlert" />
<ext:Tag Value="4" Text="Bill" Icon="UserB" />
<ext:Tag Value="5" Text="Ronald" Icon="UserDelete" />
</Items>
</ext:TagField>
<ext:Container runat="server" Layout="HBoxLayout">
<Items>
<ext:Button runat="server" Text="Add Jack" Handler="#{Tags1}.addTag('1');" />
<ext:Button runat="server" Text="Add Ext.Net" Handler="#{Tags1}.addTag('Ext.Net');" />
<ext:Button runat="server" Text="Remove Jack" Handler="#{Tags1}.removeTag('1');" />
<ext:Button runat="server" Text="Set value" Handler="#{Tags1}.setValue(['1', '2']);" />
<ext:Button runat="server" Text="Submit" OnDirectClick="SubmitHandler" />
</Items>
</ext:Container>
</Items>
</ext:Panel>
</Items>
</ext:Viewport>
</form>
protected void SubmitHandler(object sender, DirectEventArgs e)
{
string tags = "";
foreach (Tag tag in Tags1.Tags)
{
tags += " " + tag.Text;
}
X.Msg.Alert("Tags", tags).Show();
}
After running the above example, when I click on button to read the values at CodeBehind, I get this:
Server Error in '/' Application.
Type 'Ext.Net.Tags' in Assembly 'Ext.Net, Version=2.4.0.30091, Culture=neutral, PublicKeyToken=2e12ce3d0176cd87' is not marked as serializable.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.Serialization.SerializationExceptio n: Type 'Ext.Net.Tags' in Assembly 'Ext.Net, Version=2.4.0.30091, Culture=neutral, PublicKeyToken=2e12ce3d0176cd87' is not marked as serializable.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SerializationException: Type 'Ext.Net.Tags' in Assembly 'Ext.Net, Version=2.4.0.30091, Culture=neutral, PublicKeyToken=2e12ce3d0176cd87' is not marked as serializable.]
System.Runtime.Serialization.FormatterServices.Int ernalGetSerializableMembers(RuntimeType type) +11031795
System.Runtime.Serialization.FormatterServices.Get SerializableMembers(Type type, StreamingContext context) +230
System.Runtime.Serialization.Formatters.Binary.Wri teObjectInfo.InitMemberInfo() +121
System.Runtime.Serialization.Formatters.Binary.Wri teObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder binder) +182
System.Runtime.Serialization.Formatters.Binary.Wri teObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder binder) +51
System.Runtime.Serialization.Formatters.Binary.Obj ectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck) +540
System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck) +131
System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter.Serialize(Stream serializationStream, Object graph) +12
System.Web.UI.ObjectStateFormatter.SerializeValue( SerializerBinaryWriter writer, Object value) +2785
[ArgumentException: Error serializing value 'Ext.Net.Tags' of type 'Ext.Net.Tags.']
System.Web.UI.ObjectStateFormatter.SerializeValue( SerializerBinaryWriter writer, Object value) +3364
System.Web.UI.ObjectStateFormatter.Serialize(Strea m outputStream, Object stateGraph) +118
System.Web.UI.ObjectStateFormatter.Serialize(Objec t stateGraph, Purpose purpose) +71
System.Web.UI.ObjectStateFormatter.System.Web.UI.I StateFormatter2.Serialize(Object state, Purpose purpose) +8
System.Web.UI.Util.SerializeWithAssert(IStateForma tter2 formatter, Object stateGraph, Purpose purpose) +40
System.Web.UI.HiddenFieldPageStatePersister.Save() +106
System.Web.UI.Page.SavePageStateToPersistenceMediu m(Object state) +108
System.Web.UI.Page.SaveAllState() +659
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1225
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.33440
Type 'Ext.Net.Tags' in Assembly 'Ext.Net, Version=2.4.0.30091, Culture=neutral, PublicKeyToken=2e12ce3d0176cd87' is not marked as serializable.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.Serialization.SerializationExceptio n: Type 'Ext.Net.Tags' in Assembly 'Ext.Net, Version=2.4.0.30091, Culture=neutral, PublicKeyToken=2e12ce3d0176cd87' is not marked as serializable.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SerializationException: Type 'Ext.Net.Tags' in Assembly 'Ext.Net, Version=2.4.0.30091, Culture=neutral, PublicKeyToken=2e12ce3d0176cd87' is not marked as serializable.]
System.Runtime.Serialization.FormatterServices.Int ernalGetSerializableMembers(RuntimeType type) +11031795
System.Runtime.Serialization.FormatterServices.Get SerializableMembers(Type type, StreamingContext context) +230
System.Runtime.Serialization.Formatters.Binary.Wri teObjectInfo.InitMemberInfo() +121
System.Runtime.Serialization.Formatters.Binary.Wri teObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder binder) +182
System.Runtime.Serialization.Formatters.Binary.Wri teObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder binder) +51
System.Runtime.Serialization.Formatters.Binary.Obj ectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck) +540
System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck) +131
System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter.Serialize(Stream serializationStream, Object graph) +12
System.Web.UI.ObjectStateFormatter.SerializeValue( SerializerBinaryWriter writer, Object value) +2785
[ArgumentException: Error serializing value 'Ext.Net.Tags' of type 'Ext.Net.Tags.']
System.Web.UI.ObjectStateFormatter.SerializeValue( SerializerBinaryWriter writer, Object value) +3364
System.Web.UI.ObjectStateFormatter.Serialize(Strea m outputStream, Object stateGraph) +118
System.Web.UI.ObjectStateFormatter.Serialize(Objec t stateGraph, Purpose purpose) +71
System.Web.UI.ObjectStateFormatter.System.Web.UI.I StateFormatter2.Serialize(Object state, Purpose purpose) +8
System.Web.UI.Util.SerializeWithAssert(IStateForma tter2 formatter, Object stateGraph, Purpose purpose) +40
System.Web.UI.HiddenFieldPageStatePersister.Save() +106
System.Web.UI.Page.SavePageStateToPersistenceMediu m(Object state) +108
System.Web.UI.Page.SaveAllState() +659
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1225
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.33440
Last edited by GKG4; Feb 07, 2014 at 7:07 AM.