日期:2014-05-17 浏览次数:20840 次
<asp:Dropdownlist ID="Dropdownlist1" runat="server" DataSourceID="XmlDataSource2" DataTextField="Name" DataValueField="ID"> </asp:Dropdownlist> <asp:XmlDataSource ID="XmlDataSource2" runat="server" DataFile="~/XML/Zodiac.xml"></asp:XmlDataSource> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int memberId = StringHelper.GetIntParam(this.Request, "memberId", 0); if (memberId != 0) { Member member = Common.ObjectFactory.GetObject<Member>(memberId.ToString()); this.GetMembers(member); } } } private void GetMembers(Member member) { if (member != null) { string s = member.Zodiac.Value.ToString().Trim(); //输出s看看值多少? Response.Write(s); Dropdownlist1.Items.FindByText(s).Selected = true; } }