日期:2014-05-17 浏览次数:20440 次
List<Model.MenuLunch> listlunch = new List<MenuLunch>();
foreach (RepeaterItem item in rplunch.Items)
{
Model.MenuLunch lun = new Model.MenuLunch();
System.Web.UI.HtmlControls.HtmlInputHidden typehidden = (System.Web.UI.HtmlControls.HtmlInputHidden)item.FindControl("menutypeid");
Label labtypename = (Label)item.FindControl("type");
TextBox txtnum = (TextBox)item.FindControl("num");
if (!string.IsNullOrEmpty(txtnum.Text))
{
lun.typeid = Convert.ToInt32(typehidden.Value);
lun.typename = labtypename.Text;
lun.num = Convert.ToInt32(txtnum.Text);
listlunch.Add(lun);
}
}
rmtModel.rmenuDetails = JsonConvert.SerializeObject(listlunch);
string strJson=yourJson;
Newtonsoft.Json.JsonConvert.DeserializeObject<List<yourType>>(strJson)