当前位置:编程学习 > C#/ASP.NET >>

求助,一个貌似简单的编辑页 修改方法

 if (title.Text == "" || content.Text == "")
        {
            Response.Write("<script>alert('以上各项不能为空!');location.href='ReplyMG.aspx'</script>");
        }
        reply = new ReplyForum();

        reply.Replytitle = this.title.Text;
        reply.Replycont = this.content.Text;
        int count = manager.UpdateReplyForum(reply);
        if (count > 0)
        {
            Response.Write("<script>alert('修改成功!');location.href='ReplyMG.aspx'</script>");
        }
        else
        {
            Response.Write("<script>alert('修改失败!');</script>");
        }
--------------------------------------------------------------------------------------------------------------<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#a8c7ce">
                            <tr>
                                <td width="15%" height="20" bgcolor="d3eaef" class="STYLE10" align="center">
                                    <div align="center">
                                        回复标题
                                    </div>
                                </td>
                                <td align="left" bgcolor="#FFFFFF">
                                    <asp:TextBox ID="title" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td width="25%" height="20" bgcolor="d3eaef" class="STYLE10" align="center">
                                    <div align="center">
                                        回复内容
                                    </div>
                                </td>
                                <td align="left" bgcolor="#FFFFFF">
                                    <asp:TextBox ID="content" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="4" align="center" bgcolor="#EFEFEF">
                                    <asp:Button ID="tijiao" runat="server" CssClass="STYLE" 
                                        Text="修改" onclick="tijiao_Click" />
                                          
                                    <asp:Button ID="cancel" runat="server" CssClass="STYLE" 
                                        Text="清空" onclick="cancel_Click" />
                                </td>
                            </tr>
                        </table>

不知道为什么 我将文本框的值 改了又改 传过去的 还是原来数据库的值 郁闷 --------------------编程问答-------------------- if(!IsPostBack) --------------------编程问答-------------------- 没看出什么问题,你可以试试1楼的。 --------------------编程问答-------------------- 检查一下UpdateReplyForum()函数 --------------------编程问答--------------------
引用 1 楼 hjywyj 的回复:
if(!IsPostBack)

同意此观点
补充:.NET技术 ,  ASP.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,