protected void Page_Load(object sender,EventArgs e)
{
///获取参数DirID的值
if(Request.Params["DirID"] != null)
{
if(Int32.TryParse(Request.Params["DirID"].ToString(),out nParentID) == false)
{
return;
}
}
///设置上载按钮是否可用
SureBtn.Enabled = nParentID <= -1 ? false : true;
    }上面是上传文件的代码,获得文件夹id,然后判断是禁用按钮。
请教如何设置只有DirID=2的时候,按钮才有效?
谢谢!

解决方案 »

  1.   

    if(Request.Params["DirID"] != null)
    {
        int id = Convert.ToInt32(Request.Params["DirID"]);
        if (id == 2)
            SureBtn.Enabled = true;
        else
            SureBtn.Enabled = false;
    }
      

  2.   

    if not Request.queryString("DirID") is nothing then
    if isNumeric(request.queryString("DirID"))=true OrElse request.queryString("DirID")="2" then
            SureBtn.Enabled = true
        else
            SureBtn.Enabled = false
    end if
    end if