第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

后臺(tái)代碼綁定xml作為Repeater的數(shù)據(jù)源,Page_Load事件被執(zhí)行2次!

后臺(tái)代碼綁定xml作為Repeater的數(shù)據(jù)源,Page_Load事件被執(zhí)行2次!

慕萊塢森 2018-12-07 07:43:51
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Init("", "", "", "", "", ""); } if (Request.QueryString["do"] != null && Request.QueryString["do"] == "list") { Init("", "", "", "", "", ""); } } ///<summary> /// 初始document ///</summary> ///<param name="outCity1">起飛城市(中文)</param> ///<param name="toCity1">到達(dá)城市(中文)</param> ///<param name="outCode1">起飛城市(Code)</param> ///<param name="toCode1">到達(dá)城市(Code)</param> ///<param name="outDate1">起飛日期</param> ///<param name="type1">航程類型</param> private void Init(string outCity1, string toCity1, string outCode1, string toCode1, string outDate1, string type1) { //接收 往返、聯(lián)程時(shí) 選擇下一程 傳遞的參數(shù) string outCity = outCity1; string toCity = toCity1; string outCode = outCode1; string toCode = toCode1; string outDate = outDate1; string toDate = ""; string type = type1; if (Request.QueryString["do"] == "list") //接收本頁面 查詢 按鈕 傳遞的參數(shù) { outCity = Request.Form["seach_outCity"].ToString(); toCity = Request.Form["seach_toCtiy"].ToString(); outCode = Request.Form["seach_outCode"].ToString(); toCode = Request.Form["seach_toCode"].ToString(); outDate = Request.Form["seach_outDate"].ToString(); toDate = Request.Form["seach_toDate"].ToString(); type = Request.Form["seach_type"].ToString(); } else if (outCity == "") //接收首頁 查詢 按鈕 傳遞的參數(shù) { outCity = Request.QueryString["seach_outCity"].ToString(); toCity = Request.QueryString["seach_toCtiy"].ToString(); outCode = Request.QueryString["seach_outCode"].ToString(); toCode = Request.QueryString["seach_toCode"].ToString(); outDate = Request.QueryString["seach_outDate"].ToString(); toDate = Request.QueryString["seach_toDate"].ToString(); type = Request.QueryString["seach_type"].ToString(); } //開始填充 document this.lOutToCity.Text = outCity + " -- " + toCity; this.lToOutCity.Text = outCity + " - " + toCity; this.lOutDate.Text = Convert.ToDateTime(outDate).ToString("D"); //獲取低價(jià)信息 DataTable dtPromotion = ssc.GetPromotionByCity(outCode, toCode, DateTime.Now.AddDays(1).ToString("d") + " 00:00:00", DateTime.Now.AddDays(9).ToString("d") + " 23:59:59"); this.Repeater1.DataSource = dtPromotion; this.Repeater1.DataBind(); //獲取航班信息 string xml = ssc.SeachToDayFlightInfo(outCode, toCode, Convert.ToDateTime(outDate), "0600"); XmlDocument doc = new XmlDocument(); doc.LoadXml(xml); this.Repeater2.DataSource = doc.DocumentElement.ChildNodes; this.Repeater2.DataBind(); this.hidNum.Value = (doc.DocumentElement.ChildNodes.Count + 10).ToString(); Session["mark"] = "0"; } 我后臺(tái)用xml作為Repeater的數(shù)據(jù)源,可以每次Page_Load事件會(huì)被執(zhí)行2次,找了好長時(shí)間,未能找到原因。高手給回應(yīng)吧!
查看完整描述

1 回答

?
小怪獸愛吃肉

TA貢獻(xiàn)1852條經(jīng)驗(yàn) 獲得超1個(gè)贊

Page_Load事件改為:

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Init("", "", "", "", "", "");
}
else
{
if (Request.QueryString["do"] != null && Request.QueryString["do"] == "list")
{
Init("", "", "", "", "", "");
}
}
}

試試

查看完整回答
反對 回復(fù) 2019-01-21
  • 1 回答
  • 0 關(guān)注
  • 244 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號