在WebForm1.aspx.cs中
private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
 {
  //如果是交替项和项
  if(e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
    {
       e.Item.Attributes.Add("onclick", "window.open('SetUserRight2.aspx?id="type="+e.Item.Cells[2].Text+"','','width=729,height=710,left=200,scrollbars=yes')");
             
    }   
 }
在WebForm2.aspx.cs中
private void Page_Load(object sender, System.EventArgs e)
{
   string type = System.Convert.ToString(Page.Request["type"]);
}
当在从WebForm1传"管理员"到WebForm2时,跟踪,发现WebForm1中e.Item.Cells[2].Text = "管理员",但在WebForm2中获取得到的type="管理",而当我传"普通用户"的时候,type得到的又只能是"普通用"!

解决方案 »

  1.   

    string type=e.Item.Cells[2].Text ;
    e.Item.Attributes.Add("onclick", "window.open('SetUserRight2.aspx?id='"+type+"','','width=729,height=710,left=200,scrollbars=yes')");
      

  2.   

    web.config 里面改成 gb2312
      

  3.   

    e.Item.Attributes.Add("onclick", "window.open('SetUserRight2.aspx?id='"+e.Item.Cells[2].Text+"','','width=729,height=710,left=200,scrollbars=yes')");
      

  4.   

    在WebConfig 进行如下设置:<globalization   requestEncoding="gb2312"   responseEncoding="gb2312"/>
      

  5.   

    不建议使用gb2312,在传递数据时对JS进行编码,在服务器用System.Text.Encoding进行解码,以UTF8进行就可以了
      

  6.   

    在WebConfig 进行如下设置:<globalization   requestEncoding="gb2312"   responseEncoding="gb2312"/>