| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1276 人关注过本帖
标题:怪事!读不到TextBox控件修改后的内容……
取消只看楼主 加入收藏
foshan
Rank: 1
等 级:新手上路
威 望:2
帖 子:605
专家分:0
注 册:2006-3-1
结帖率:100%
收藏
 问题点数:0 回复次数:2 
怪事!读不到TextBox控件修改后的内容……
我有一个页面,是用来修改之前录入数据的,但奇怪的是:当提交修改后,不能读取TextBox控件修改后的内容,依然是修改前的内容。请大家帮忙看看是什么原因……

代码如下:
    protected void Page_Load(object sender, EventArgs e)
    {
        GongChengFuKuan r = GongChengFuKuan.GetResume_FuKuanDengJi(int.Parse(Session["ShiGongHeTongFuKuanDengJiGuanLi_FuKuanDengJiID"].ToString()));
        TextBox1.Text = r.XuHao;
        TextBox2.Text = r.FuKuanShiJian;
        TextBox3.Text = r.JiLuZhuangTai;
        DropDownList1.SelectedValue = r.FuKuanFangShi;
        TextBox4.Text = r.FuKuanJinE;
        DropDownList2.SelectedValue = r.BiZhong;
        TextBox5.Text = r.HuiLu;
        TextBox6.Text = r.ZheSuanJinE;
        TextBox7.Text = r.ShouKuanDanWei;
        TextBox8.Text = r.KaiHuYinHang;
        TextBox9.Text = r.YinHangZhangHao;
        TextBox10.Text = r.JieSuanFangShi;
        DropDownList3.SelectedValue = r.PiaoJuLeiXing;
        TextBox11.Text = r.JingBanRen;
        TextBox12.Text = r.JieSuanDanHao;
        TextBox13.Text = r.PiaoJuHao;
        TextBox14.Text = r.JingBanShiJian;
        TextBox15.Text = r.BeiZhu;
    }
    protected void Button1_Click(object sender, EventArgs e)//提交修改
    {
        GongChengFuKuan FuKuanDengJi = new GongChengFuKuan();
        FuKuanDengJi.XuHao = TextBox1.Text.ToString().Trim();
        FuKuanDengJi.FuKuanShiJian = TextBox2.Text.ToString().Trim();
        FuKuanDengJi.JiLuZhuangTai = TextBox3.Text.ToString().Trim();
        FuKuanDengJi.FuKuanFangShi = DropDownList1.SelectedValue;
        FuKuanDengJi.FuKuanJinE = TextBox4.Text.ToString().Trim();
        FuKuanDengJi.BiZhong = DropDownList2.SelectedValue;
        FuKuanDengJi.HuiLu = TextBox5.Text.ToString().Trim();
        FuKuanDengJi.ZheSuanJinE = TextBox6.Text.ToString().Trim();
        FuKuanDengJi.ShouKuanDanWei = TextBox7.Text.Trim().ToString();
        FuKuanDengJi.KaiHuYinHang = TextBox8.Text.ToString().Trim();
        FuKuanDengJi.YinHangZhangHao = TextBox9.Text.ToString().Trim();
        FuKuanDengJi.JieSuanFangShi = TextBox10.Text.ToString().Trim();
        FuKuanDengJi.PiaoJuLeiXing = DropDownList3.SelectedValue;
        FuKuanDengJi.JingBanRen = TextBox11.Text.ToString().Trim();
        FuKuanDengJi.JieSuanDanHao = TextBox12.Text.ToString().Trim();
        FuKuanDengJi.PiaoJuHao = TextBox13.Text.ToString().Trim();
        FuKuanDengJi.JingBanShiJian = TextBox14.Text.ToString().Trim();
        FuKuanDengJi.BeiZhu = TextBox15.Text.ToString().Trim();
        GongChengFuKuan.UpdateFuKuanDengJi(FuKuanDengJi);
        //关闭子窗口并返回父窗口并模拟单击父窗口的Button13按扭引发其click事件,实现子窗口提交数据后即时异步刷新父窗口中的GridView控件
        Page.ClientScript.RegisterStartupScript(this.GetType(), "Test1", "<script>close();opener.document.all('Button13').click();</script>");
    }
    protected void Button2_Click(object sender, EventArgs e)//取消
    {
        Response.Write("<script>close()</script>");
    }
图片附件: 游客没有浏览图片的权限,请 登录注册
搜索更多相关主题的帖子: TextBox控件 怪事 sender void Session 
2007-12-12 14:46
foshan
Rank: 1
等 级:新手上路
威 望:2
帖 子:605
专家分:0
注 册:2006-3-1
收藏
得分:0 
protected void Button1_Click(object sender, EventArgs e)//提交修改

Button1的Click事件内的代码不能读取TextBox控件修改后的内容,依然是修改前的内容,奇怪啊……

我是2.0超级菜鸟,请多多教导!
2007-12-12 14:48
foshan
Rank: 1
等 级:新手上路
威 望:2
帖 子:605
专家分:0
注 册:2006-3-1
收藏
得分:0 
找到问题所在了:原来没有在 Page_Load 中加 if (!IsPostBack){……}

我是2.0超级菜鸟,请多多教导!
2007-12-12 16:04
快速回复:怪事!读不到TextBox控件修改后的内容……
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018150 second(s), 11 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved