asp.net 取值问题
MangerClassmc=newMangerClass();protectedvoidPage_Load(objectsender,EventArgse){GetGoo...
MangerClass mc = new MangerClass();
protected void Page_Load(object sender, EventArgs e)
{
GetGoodsInfo();
}
public void GetGoodsInfo()
{
DataSet ds = mc.ReturnNewInfoById(Convert.ToInt32(Request["NewsId"].Trim()), "NewInfo");
newid.Text = ds.Tables["NewInfo"].Rows[0][0].ToString();
newtitle.Text = ds.Tables["NewInfo"].Rows[0][1].ToString();
newcontent.Text = ds.Tables["NewInfo"].Rows[0][2].ToString();
isedited.Checked = Convert.ToBoolean(ds.Tables["NewInfo"].Rows[0]["IsEdited"].ToString());
}
protected void btnUpdate_Click(object sender, EventArgs e)
{
if (newtitle.Text == "" || newcontent.Text == "")
{
Response.Write("<script>alert('请输入必要的公告信息!')</script>");
}
else
{
bool IsEdited;
int inputmanageid;
if (Session["AID"] != null)
{
inputmanageid = Convert.ToInt32(Session["AID"]);
}
else
{
inputmanageid = Convert.ToInt32("1");
}
if (isedited.Checked.Equals(true))
{
IsEdited = true;
}
else
{
IsEdited = false;
}
mc.UpdateNewInfo(Convert.ToInt32(newid.Text.Trim()), newtitle.Text.Trim(), newcontent.Text.Trim(), inputmanageid, IsEdited);
Response.Write(newcontent.Text.Trim());
Response.Write(Convert.ToInt32(newid.Text.Trim()));
Response.Write(newtitle.Text.Trim());
//Response.Write("<script>alert('新闻修改成功!');location='NewsManage.aspx';</script>");
}
}
获得的不是前台.aspx 传来的值,而是之前GetGoodsInfo赋予的值 为什么????? 展开
protected void Page_Load(object sender, EventArgs e)
{
GetGoodsInfo();
}
public void GetGoodsInfo()
{
DataSet ds = mc.ReturnNewInfoById(Convert.ToInt32(Request["NewsId"].Trim()), "NewInfo");
newid.Text = ds.Tables["NewInfo"].Rows[0][0].ToString();
newtitle.Text = ds.Tables["NewInfo"].Rows[0][1].ToString();
newcontent.Text = ds.Tables["NewInfo"].Rows[0][2].ToString();
isedited.Checked = Convert.ToBoolean(ds.Tables["NewInfo"].Rows[0]["IsEdited"].ToString());
}
protected void btnUpdate_Click(object sender, EventArgs e)
{
if (newtitle.Text == "" || newcontent.Text == "")
{
Response.Write("<script>alert('请输入必要的公告信息!')</script>");
}
else
{
bool IsEdited;
int inputmanageid;
if (Session["AID"] != null)
{
inputmanageid = Convert.ToInt32(Session["AID"]);
}
else
{
inputmanageid = Convert.ToInt32("1");
}
if (isedited.Checked.Equals(true))
{
IsEdited = true;
}
else
{
IsEdited = false;
}
mc.UpdateNewInfo(Convert.ToInt32(newid.Text.Trim()), newtitle.Text.Trim(), newcontent.Text.Trim(), inputmanageid, IsEdited);
Response.Write(newcontent.Text.Trim());
Response.Write(Convert.ToInt32(newid.Text.Trim()));
Response.Write(newtitle.Text.Trim());
//Response.Write("<script>alert('新闻修改成功!');location='NewsManage.aspx';</script>");
}
}
获得的不是前台.aspx 传来的值,而是之前GetGoodsInfo赋予的值 为什么????? 展开
展开全部
回发页问题
改成
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
GetGoodsInfo();
}
}
改成
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
GetGoodsInfo();
}
}
参考资料: http://zhidao.baidu.com/question/89446840.html
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询