对不起,上面写的有点问题:应该是string strInputType=Request.QueryString.Get("type")
解决方案 »
- asp.net做迅雷下载功能问题
- 图片左移问题--新手
- HttpContext.Current.Session 和 直接写Session 是一样的吗
- ASP.NET 图片验证码的问题.找了《ASP.NET第一步》里的一个例子,但是无法生成.朱哗写的书.大家帮我看看怎么写这个Page_Load的代码
- 请问如果把数据库数据存入word文件
- 链接简单问题,正解后解贴!
- 小难一把:如何得到iframe的SRC值?
- 老赵的AJAX视频课程全集下载地址Zz
- 关于导出Excel的问题
- DropDownList1_SelectedIndexChanged()為何備執行兩次
- 求救!怎么在服务器端将HTML页面转换为WORD?
- 全文搜索问题·
if(Request.QueryString["ID"]!=null
{
Request.QueryString["ID"].ToString();
}
string type=(string)Request.QueryString["type"];
string ID=(string)Request.QueryString["ID"];
你把代码贴出来?
{
string type=(string)Request.QueryString["type"] ;
Response.Write(type);
}
代码就是这样的
这样你判断下是否为空
if(Request.QueryString["ID"]!=null
{
Request.QueryString["ID"].ToString();
}
else
{
Response.Write("没有传过来哦!!")
}
如果出现else则检查你前面的传值
}
{
string type=Request.QueryString["type"].ToString();
Response.Write(type);
}
试着这样
http://localhost/xxx.aspx?id=0&typ=2
路径你调整下,看看是什么结果
首先我在a页中用JS打开b页并传值:
window.open("b.aspx?Type=" + InputType + "&ID=" + n + "&Name=" + Name ,"_self");
然后,再b.aspx.cs的Page_Load中是这么写的:
private void Page_Load(object sender, System.EventArgs e)
{
if (Request.QueryString["InputType"] != null)
{
string strInputType=Request.QueryString["InputType"].ToString() ;
if (strInputType="1")
{
string Name=Request.QueryString["Name"].ToString();
textBoxName.Text=Name;
}
}
else
{
Response.Write("没有值!");
}
}
运行后,在b页的地址栏中的网址是:
http://localhost/Test/b.aspx?Type=1&ID=1&Name=地坛但是b页没有任何变化:textBoxName中没有数据,也没有显示“没有值”,郁闷ing.....
呵呵,这句错啦
应该是
string strInputType=Request.QueryString["Type"].ToString()
if (Request.QueryString["Type"] != null)
{
string strInputType=Request.QueryString["Type"].ToString() ;
if (strInputType=="1")
{
string Name=Request.QueryString["Name"].ToString();
textBoxName.Text=Name;
}
}
else
{
Response.Write("没有值!");
}
我只建了一个页面,然后直接用下面的地址访问,你试试看,应该是前面跳转过来的问题。
http://localhost/upload/try.aspx?Type=1&Name=论坛
Name的值如果是中文显示是一个方框,如果是英文,可以显示
这个应该是if (strInputType=="1")吧
呵呵,自己学到了知识..
传送中文时用下面的
string Name=Server.HtmlDecode(Request.QueryString["Name"].ToString());textBoxName.Text=Name;HtmlDecode是对已被编码以消除无效 HTML 字符的字符串进行解码