在这里,我使用 XML 加载我的下拉值。在 HTTPPost 期间,从 XML 加载这些下拉值后,所有其他模型值都变为空,我的模型只有这些下拉值。
[HttpPost]
public ActionResult Analyze(AnalyzeModels model)
{
if (ModelState.IsValid)
{
model.RequestID = ObjCommon.GenerateRequsetID(ObjSharedEntities.UserID, "ATA_1"); // Generation of the Request ID
}
model.ChartName = ObjCommon.GetFusionSWFReportName("ASTrend", "ATA_1");
var ppgFile = Server.MapPath(DataTemplate.PPGXmlPath);
var ppgItems =
from brand in XDocument.Load(ppgFile).Descendants("PPGItem")
select new SelectListItem
{
Value = brand.Element("Value").Value,
Text = brand.Element("Text").Value
};
model = new AnalyzeModels
{
PPGItems = ppgItems
};
return View(model);
}
有什么建议吗?