none
ListItem item = DropDownList1.Items.FindByValue(theme);///这句话是干啥呀? RRS feed

  • 问题

  • using System;
    using System.Data;
    using System.Configuration;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;

    public partial class _Default : System.Web.UI.Page
    {
        public string theme;
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        void Page_PreInit(Object sender, EventArgs e)
        {
            if (Request.QueryString["theme"] == null)
            {
                theme = "Themes1";
            }
            else
            {
                theme = Request.QueryString["theme"];
            }

            Page.Theme = theme;//加载主题
            ListItem item = DropDownList1.Items.FindByValue(theme);///这句话是干啥呀?
            if (item != null)
            {
                item.Selected = true;
            }
        }

        protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {

            string url = Request.Path + "?theme=" + DropDownList1.SelectedItem.Value;

            Response.Redirect(url);
        }
    }


    maiyude
    2010年3月1日 8:54

答案

全部回复