日期:2014-05-19  浏览次数:20581 次

问个有关DataGrid 比较菜菜的问题 ~~~ @-@
xml报文

<?xml   version= "1.0 "   encoding= "UTF-8 "?>
<orgUnit   id= "2 "   name= "办公室 ">
<user>
<param   name= "category "   value= " "/>
<param   name= "createdate "   value= "2007-3-28 "/>
<param   name= "email "   value= "clj@jsppd.gov.cn "/>
<param   name= "mobile "   value= "1234567890 "/>
<param   name= "orgid "   value= "2 "/>
<param   name= "orgname "   value= " "/>
<param   name= "otherway "   value= "1234567890 "/>
<param   name= "password "   value= "666 "/>
<param   name= "phone "   value= " "/>
<param   name= "position "   value= "主任 "/>
<param   name= "realname "   value= "陈立军 "/>
<param   name= "registerdate "   value= "2007-3-28 "/>
<param   name= "servicedate "   value= "2018-10-11 "/>
<param   name= "status "   value= "N "/>
<param   name= "type "   value= "01 "/>
<param   name= "userdsc "   value= "陈立军 "/>
<param   name= "userid "   value= "135 "/>
<param   name= "username "   value= "clj@jsppd.gov.cn "/>
</user>
</orgUnit>
======================================================
XmlDocument   dom   =   new   XmlDocument();
dom.LoadXml(usersxml);
XmlNodeList   nodes   =   dom.SelectNodes( "orgUnit/user/param[@name= 'realname '] ");
if   (nodes   !=   null)
{
  DataTable   dt   =   new   DataTable();
  dt.Columns.Add( "name ",   Type.GetType( "System.String "));
  foreach   (XmlNode   node   in   nodes)
  {
  DataRow   row   =   dt.NewRow();
  row[ "name "]   =   node.Attributes[ "value "].Value;
  dt.Rows.Add(row);
}
  this.DataGrid1.DataSource=dt;
  this.DataGrid1.DataBind();
}

第一个问题     想知道     如何   再加另一个
<param   name= "mobile "   value= "1234567890 "/>
mobile的值     是不是   必须再加一个
XmlNodeList   nodes2   =   dom.SelectNodes( "orgUnit/user/param[@name= 'mobile '] ");

  foreach   (XmlNode   node   in   nodes2)
  {
  DataRow   row   =   dt.NewRow();
  row[ "name "]   =   node.Attributes[ "value "].Value;
  dt.Rows.Add(row);
}
  this.DataGrid1.DataSource=dt;
  this.DataGrid1.DataBind();
}


这样的话     DG   中不是覆盖了原来   realname的值么   ?       有办法   再增加么?


第2个问题
在DG中   也   捆绑了   Checkbox   控件  
选择   后   对相应的行   该如何操作?

private   void   OKBtn_Click(object   sender,   System.EventArgs   e)
{ <