post表单时原来页面上的静态字段会清空么?

-Sykes -Sykes 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
public partial class Admin_addMenu : System.Web.UI.Page
{
protected string id;
protected void Page_Load(object sender, EventArgs e)
{

if (!IsPostBack)
{
id = Request.QueryString["id"];
if (id != "" && id != null)
{
getList();
this.tijiao.Value = "编辑";
DataSet ds = MenuDAL.returnGlobal(id);
ds = MenuDAL.returnGlobal(id);
this.title.Value = ds.Tables[0].Rows[0]["Title"].ToString();
this.link.Value = ds.Tables[0].Rows[0]["pageLink"].ToString();
this.menuid.Value = ds.Tables[0].Rows[0]["ID"].ToString();
this.isuse.SelectedIndex = ((ds.Tables[0].Rows[0]["isUse"].ToString().ToLower()) == "true") ? 1 : 0;
this.myDropdownlist.SelectedValue = ds.Tables[0].Rows[0]["parentID"].ToString();
}
else
{
this.tijiao.Value = "提交";
getList();
}
}


}
protected void addMenu(object sender, EventArgs e)
{
string _title = this.title.Value;
string _link = this.link.Value;
string _id = this.menuid.Value;
string _parentid = myDropdownlist.SelectedValue;
string _isUse = this.isuse.Value;
int result = (id != null && id != "") ? 1 : -1;
result = MenuDAL.isSuccess(result, _title, _link, _id, _parentid, _isUse);
if (result > 0)
{
RegisterStartupScript("提示", "<script>alert('操作成功!');location.href='WebSet.aspx'</script>");
}
else
{
RegisterStartupScript("提示", "<script>alert('操作失败!');</script>");
}
}
}

这是一个栏目编辑页面,如果栏目是新增加的话就不会查询到id值,但是如果是编辑原有的栏目的话就回有id值,通过 Request.QueryString方法找到这个值,但是当我点击提交按钮的时候他这个值就没了前台是用的post 方法,然后提交按钮是
<input type="submit" value=" 编辑 " style="padding: 2px 3px" runat="server" onserverclick="addMenu"
id="tijiao" />

点击提交的时候在提交事件里就查找不到id这个值了
...全文
评论 4
收藏 已收藏
分享
返回顶部
-Sykes
.NET社区 62,274 成员 668,968 内容