asp.net ¶ÁÈ¡XmlÎļþ²¢½øÐÐDropDownListÊý¾Ý°ó¶¨
<asp:DropDownList ID="compactType" runat="server" AutoCallBack="True" Width="153px"> </asp:DropDownList>
<?xml version="1.0" encoding="utf-8" ?>
<roots>
<root>
<id>1</id>
<Culture>³õÖÐÒÔÏÂ</Culture>
</root>
<root>
<id>2</id>
<Culture>³õÖÐ</Culture>
</root>
<root>
<id>3</id>
<Culture>ÖÐר</Culture>
</root>
<root>
<id>4</id>
<Culture>¸ßÖÐ</Culture>
</root>
<root>
<id>5</id>
<Culture>´óר</Culture>
</root>
<root>
<id>6</id>
<Culture>±¾¿Æ</Culture>
</root>
</roots>
/// <summary>
/// ¶ÁÈ¡xmlÎļþ,ÓÃÊý¾ÝÌî³äDropDownList,½øÐаó¶¨
/// </summary>
/// <param name="path">xmlÎļþ·¾¶</param>
/// <param name="dp">Òª½øÐа󶨵ÄDropDownListÃû³Æ</param>
/// <param name="id">DropDownListÒªÏÔʾµÄÎı¾(xmlÎļþµÄÒ»¸ö½Úµã)</param>
/// <param name="val">DropDownListÒªÏÔʾµÄÖµ(xmlÎļþµÄÒ»¸ö½Úµã)</param>
public void ReadXml(string path,DropDownList dp,string id,string val)
{
DataSet ds = new DataSet();
ds.ReadXml(path);
dp.DataSource = ds;
dp.DataTextField = id ;
dp.DataValueField = val;
dp.DataBind();
}
SecurityFactory sf = new SecurityFactory();
//xmlÎļþ·¾¶
string path2 = Server.MapPath("./xml/XMLFile2.xml");
sf.ReadXml(path2, this.compactType, "id", "val");
Ïà¹ØÎĵµ£º
¡¡¡¡¼ÌÐøÑ§Ï°D-Bus¡£Ö®Ç°Ñ§Ï°ÁËʹÓõײãµÄAPIÀ´·¢ËÍ£¬¼àÌýÏûÏ¢µÄ·½Ê½¡£ÔÚ
D-
Busѧϰ£¨ËÄ£©£º»ù´¡Ð¡Àý×Ó£¨Í¬²½ºÍÒì²½£©
Ö®ÖУ¬ÎÒÃǸø³öÁËÀûÓÃproxy½øÐз¢ËÍmethod_call£¬²¢µÈ´ýmethod_reply»òÕßerrorµÄclientÇé¿ö¡£ÔÚD-BusÖУ¬¿ÉÒÔ½«D-Bus½Ó¿Ú¶¨ÒåÓÃXML¸ñʽ±íÊö´¦Àí£¬²¢ÀûÓù¤¾ß£¬×Ô¶¯Éú³ÉÍ·Îļþ£¬¸ø³ö¹¤ÕûµÄµ÷Ó÷½Ê½¡ ......
Ò»¡¢¼òµ¥½éÉÜ
using System.Xml;
//³õʼ»¯Ò»¸öxmlʵÀý
XmlDocument xml=new XmlDocument();
//µ¼ÈëÖ¸¶¨xmlÎļþ
xml.Load(path);
xml.Load(HttpContext.Current.Server.MapPath("~/file/bookstore.xml"));
//Ö¸¶¨Ò»¸ö½Úµã
XmlNode root=xml.SelectSingleNode("/root");
//»ñÈ¡½ÚµãÏÂËùÓÐÖ±½Ó×Ó½Úµã
XmlNodeList ch ......
1 ÔÚActionʵÏÖÀà·½ÃæµÄ¶Ô±È£ºStruts 1ÒªÇóActionÀà¼Ì³ÐÒ»¸ö³éÏó»ùÀࣻStruts 1µÄÒ»¸ö¾ßÌåÎÊÌâÊÇʹÓóéÏóÀà±à³Ì¶ø²»Êǽӿڡ£Struts 2 ActionÀà¿ÉÒÔʵÏÖÒ»¸öAction½Ó¿Ú£¬Ò²¿ÉÒÔʵÏÖÆäËû½Ó¿Ú£¬Ê¹¿ÉÑ¡ºÍ¶¨ÖƵķþÎñ³ÉΪ¿ÉÄÜ¡£Struts 2Ìṩһ¸öActionSupport»ùÀàȥʵÏÖ³£ÓõĽӿڡ£¼´Ê¹Action½Ó¿Ú²»ÊDZØÐëʵÏֵģ¬Ö»ÓÐÒ» ......
¶Ô“Ìí¼Ó”¡¢“Ìá½»”¡¢“±£´æ”¡¢“¸üДµÈ°´Å¥ÐèÒª¶ÔÊý¾Ý¿â½øÐÐд²Ù×÷µÄ°´Å¥£¬Ò»¶¨ÒªÔÚÒ³Ãæ³õʼ»¯Ê±¼ÓÔØ½Å±¾£¬·ÀÖ¹¶à´ÎÖØ¸´µã»÷£¬ÀýÈ磺
protected void Page_Load(object sender, EventArgs e)
{
//.net 2.0ÒÔÉÏ
......
Ò»¡¢(µ¥Öµ°ó¶¨)ÔÚÒ³ÃæµÄºǫ́´úÂëÖж¨Ò幫ÓбäÁ¿,ÈçÏ£º
public string gongYou = "ÉùÃ÷µÄ¹«ÓгÉÔ±";
¡¡¢ÙÈ»ºóÔÚÒ³ÃæµÄÔ´Öе÷Óã¬ÈçÏ£º
<asp:Label ID="lblMgs" runat="server" Text="<%#gongYou >"></asp:Label>
¡¡ ¢Úµ±È»×îºóÒª¼ÇµÃ°ó¶¨Êý¾Ý£º
protected void Page_Load(object ......