protected void Page_Load(object sender, EventArgs e) { if (!base.IsPostBack) { string str = BasePage.RequestString("Action", "Add"); this.ViewState["action"] = str; if (str == "Modify") { WordReplaceInfo infoById = new WordReplaceInfo(); infoById = WordReplace.GetInfoById(BasePage.RequestInt32("ItemID")); this.TxtSourceWord.Text = infoById.SourceWord; this.TxtTargetWord.Text = infoById.TargetWord; this.TxtPriority.Text = infoById.Priority.ToString(); this.RadioIsEnabled.SelectedValue = infoById.IsEnabled.ToString(); this.HdnSource.Value = infoById.SourceWord.ToString(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!base.IsPostBack && (BasePage.RequestString("Action", "Add") == "Modify")) { int id = BasePage.RequestInt32("ItemID"); if (id == 0) { AdminPage.WriteErrMsg("<li>ID不能为空!</li>"); } WordReplaceInfo infoById = WordReplace.GetInfoById(id); if (!infoById.IsNull) { this.TxtSourceWord.Text = infoById.SourceWord; this.TxtTargetWord.Text = infoById.TargetWord; this.TxtTitle.Text = infoById.Title; this.TxtReplaceTimes.Text = infoById.ReplaceTimes.ToString(); this.TxtPriority.Text = infoById.Priority.ToString(); this.RadlOpenType.SelectedValue = infoById.OpenType.ToString(); this.RadioIsEnabled.SelectedValue = infoById.IsEnabled.ToString(); this.HdnSource.Value = infoById.SourceWord.ToString(); } } }