IsPostBack的问题

从blog.org的我的原博客中迁入

发表时间:2007-10-14 10:04:52

procedure teditnewspage.Page_Load(sender: System.object; e: System.EventArgs);
var
  Id: string;
  listitem1: listitem;
  user1: tleftpanel;
begin

   ...
  Id := Request.Params['RootId'];

  if Assigned(Id) and (Id <> '') then
    anews := objectforid(id).AsObject as news;

    listitem1 := dropdownlist1.Items.FindByText(anews.newstype.mc);
    txt1.Text := anews.title;
    fckeditor1.Value := anews.news;
    dropdownlist1.SelectedIndex := dropdownlist1.Items.IndexOf(listitem1);


  if not IsPostBack then
  begin

    DataBind;
  end;

  // TODO: Put user code to initialize the page here
end;

在修改信息保存时,总是不能保存自己在文本框中输入内容,测试不保存文本框内容,而只是一个具体的字符串时正确,才意识到ispostback问题,每次都对这个文本框元件进行了刷新,所以我将红色的这段代码放到 if语句里面,问题解决.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值