Unable to cast object of type 'System.String' to type 'System.Data.DataTable'.
Please help me how to resolved this error
my code
ctx.TempLedgerBranches.Add(postData);
Session["postData"] = postData;
DataTable mdt = (DataTable)Session["postData"]; error show on this line


Manish Kumar ChoudharyRank #339 · 7.4K reputationPosted Dec 11, 2014, 7:08 PM EST
it's simply means that Session["postData"] does not contains proper dataTable format. so you are getting this error. check Session["postData"] contains proper dataTable or not.
if Session["postData"] contains only string then u need to add that string inside DataTable rows
by using following code
DataTable dt = new DataTable("PostData");
DataColumn colPData = new DataColumn("colPData",typeof(System.String));
dt.Rows.Add(Session["postData"].Tostring());
dipti prasad76 reputationPosted Dec 11, 2014, 7:26 PM EST
You have knowledge in mvc??
Please help me how to store temparory data in jqgrid. how to add edit delete temp data in jqgrid??????? Please Please help me.....
Manish Kumar ChoudharyRank #339 · 7.4K reputationPosted Dec 11, 2014, 8:02 PM EST
check u previous question i reply there.