我有xml文件,我需要根据新的客户端要求每次更新.大多数情况下,由于手动更新xml文件,xml不正确.我正在考虑编写一个程序(web/windows),提供适当的验证.并根据ui的输入,我将创建xml文件.下面是我的示例xml文件.
<community>
<author>xxx xxx</author>
<communityid>000</communityid>
<name>name of the community</name>
<addresses>
<registeredaddress>
<addressline1>xxx</addressline1>
<addressline2>xxx</addressline2>
<addressline3>xxx</addressline3>
<city>xxx</city>
<county>xx</county>
<postcode>0000-000</postcode>
<country>xxx</country>
</registeredaddress>
<tradingaddress>
<addressline1>xxx</addressline1>
<addressline2>xxx</addressline2>
<addressline3>xxx</addressline3>
<city>xxx</city>
<county>xx</county>
<postcode>0000-000</postcode>
<country>xxx</country>
</tradingaddress>
</addresses>
<community>
Run Code Online (Sandbox Code Playgroud)
任何人都可以帮助我什么是最好的方法?
我有局部视图部门包含部门信息.我有员工的页面视图.在员工视图中我使用部门视图来显示员工部门.我的员工模型如下
class Employee
{
public string EmployeeName{get;set};
public Department EmployeeName{get;set};
}
class Department
{
public string DepartmentName{get;set};
}
Run Code Online (Sandbox Code Playgroud)
我在员工页面视图上提交了按钮.当我提交员工视图时,我将Department对象视为null.你能否告诉我如何在回发期间获得儿童部门模型.Coltroller代码
[HttpGet]
public ActionResult Employee2()
{
Employee e = new Employee();
e.EmployeeName = "Prashant";
e.Department = new Department() { DepartmentName = "Phy" };
return View(e);
}
[HttpPost]
public ActionResult Employee2(Employee e)
{
return View(e);
}
Run Code Online (Sandbox Code Playgroud)
查看
部门
@model MvcApplication2.Models.Department
<script src="~/Scripts/jquery-1.7.1.min.js"></script>
<script src="~/Scripts/jquery.validate.min.js"></script>
<script src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>
<fieldset>
<legend>Department</legend>
<div class="editor-label">
@Html.LabelFor(model => model.DepartmentName)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.DepartmentName)
@Html.ValidationMessageFor(model => model.DepartmentName)
</div> …Run Code Online (Sandbox Code Playgroud) public class MyClass
{
public byte[] Bytes{get;set;}
}
MyClass obj = new MyClass();
obj.Bytes = new byte[]{1,22,44,55};
string s_result = Newtonsoft.Json.JsonConvert.SerializeObject(obj);
// my s_result looks like {"Bytes":"KQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="}
Run Code Online (Sandbox Code Playgroud)
我想要像 "Bytes":"1,22,44,55" 这样的结果
我通过在类中再创建一个 int[] 属性来解决这个问题,例如
public class MyClass
{
[JsonIgnore]
public byte[] Bytes{get;set;}
public int[] MessageByte
{
get
{
if (this.Bytes == null)
return null;
int[] result = new int[this.Bytes.Length];
for (int i = 0; i < this.Bytes.Length; i++)
{
result[i] = this.Bytes[i];
}
return result;
}
}
}
Run Code Online (Sandbox Code Playgroud)
有什么建议 ?
我对asp.net会话管理非常了解.
但我对此几乎没有任何疑问.
任何给我非常深入了解会话的链接/书都会对我有所帮助.
提前致谢 !!!PRASHANT