DemonsRevenge
New Member
pleas help me figure this out...the error i am getting is:\[code\]Type 'OrgPermission' in Assembly 'App_Code.ptjvczom, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable. \[/code\]here is my code:i have a gridview that uses the following DataSource:\[code\] <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetOrgList" TypeName="Org"> <SelectParameters> <asp:SessionParameter Name="orgCodes" SessionField="UserOrgs" Type="Object" /> <asparameter DefaultValue="http://stackoverflow.com/questions/15707872/Y" Name="active" Type="String" /> </SelectParameters> </asp:ObjectDataSource>\[/code\]i set the session variable in my page load like so:\[code\]User cUser = new User(userid); //make sure the user is an Admin List<OrgPermission> orgs = new List<OrgPermission>(); foreach(OrgPermission org in cUser.orgs) { if (org.type=='admin') { orgs.Add(org); } } Session["UserOrgs"] = orgs;\[/code\]my user class looks like this:\[code\]public class OrgPermission{ public string Org { get; set; } public List<string> type { get; set; } public OrgPermission() { }}public class cUser{ public string userid { get; set; } public List<OrgPermission> orgs { get; set; } public clsUser(string username) {//i set everything here}\[/code\]i can't understand why it's breaking, can i use it without making it serializable?i tried to debug, and the session variable sets just fine, it then goes into the GetOrgList and returned correct results, but i the page does not load and i get the error above.here is a snippet of my GetOrgList function:\[code\]public DataTable GetOrgList(List<OrgPermission> orgCodes, string active) { string orgList = null; //code to set OrgList using the parameter is here. DataSet ds = new DataSet(); SqlConnection conn = new SqlConnection(cCon.getConn()); SqlCommand cmd = new SqlCommand("sp_GetOrgList", conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@orgList", orgList)); cmd.Parameters.Add(new SqlParameter("@active", active)); conn.Open(); SqlDataAdapter sqlDA = new SqlDataAdapter(); sqlDA.SelectCommand = cmd; sqlDA.Fill(ds); conn.Close(); return ds.Tables[0]; }\[/code\]