您的位置:程序门 -> .net技术 -> c#



江湖救济,发分拉


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


江湖救济,发分拉
发表于:2007-03-16 14:13:15 楼主
response.redirect( "seachban.aspx?id=3&seach= "+this.textbox1.text);
为什么我这样传送seach为空
发表于:2007-03-16 14:15:051楼 得分:0
外行话,不要笑话我:)

是不是要用单引号“ '”括起来才行
发表于:2007-03-16 14:16:112楼 得分:0
需要进行urlencode
发表于:2007-03-16 14:17:013楼 得分:0
不应该     按理说这绝对正确的阿
发表于:2007-03-16 14:19:464楼 得分:0
自动提交,
发表于:2007-03-16 14:20:355楼 得分:0
支持
发表于:2007-03-16 14:21:296楼 得分:0
按理说没错阿
发表于:2007-03-16 14:21:347楼 得分:0
首先   确定你的   this.textbox1.text   这个值是被取到了的
发表于:2007-03-16 14:21:398楼 得分:0
去掉控件的autopostback!
否则   先执行load方法,这时this.textbox1.text=“”了。
所以你提交后是“”。
发表于:2007-03-16 14:22:529楼 得分:0
我说的只是一种情况,错了么怪。:)
发表于:2007-03-16 14:23:2310楼 得分:0
不应该呀,这样子似乎没有写错
发表于:2007-03-16 14:23:2411楼 得分:0
这样写肯定无错   跟踪一下   this.textbox1.text   的值看看。
发表于:2007-03-16 14:24:2112楼 得分:0
或许   this.textbox1.text   本身就是 "空 "
你是不是在   void   page_load()   里在没有   if   (!ispostback)   限制的情况下
  对   this.textbox1   做了 "手脚 "
发表于:2007-03-16 14:26:2013楼 得分:0
取textbox1.text的时候先alert一下   它到底有没有值
response.write( " <script> alert( ' "+   this.textbox1.text   + " ') </script> ")
或者断点调试一下,
然后在response.redirect( "seachban.aspx?id=3&seach= "+   server.urlendcode(this.textbox1.text));试试
发表于:2007-03-16 14:28:0614楼 得分:0
不是字符超长了?
发表于:2007-03-16 14:29:3315楼 得分:0
我试过了,用
response.redirect( "seachban.aspx?id=3&seach= "+this.textbox1.text);
后可以取得到值,我是如下取的:

response.redirect( "seachban.aspx?id=3&seach= "+this.textbox1.text);
protected   void   page_load(object   sender,   eventargs   e)
{
for   (int   i   =   0;   i   <   this.request.querystring.count;   i++)
{
string   s   =   this.request.querystring[i];
}
}
s的值以次是
3
abcd         //我文本框里输入的字符串就是abcd
发表于:2007-03-16 14:30:2616楼 得分:0
看詳細情況而言,不發生意應該是沒錯的
发表于:2007-03-16 14:31:3217楼 得分:0
如果加上对this.ispostback的判断则是如下的样式:

protected   void   page_load(object   sender,   eventargs   e)
{
if   (!this.ispostback)
{
for   (int   i   =   0;   i   <   this.request.querystring.count;   i++)
{
string   s   =   this.request.querystring[i];
}
string   seach   =   this.request.querystring[ "seach "];
}
}
发表于:2007-03-16 14:34:4618楼 得分:0
是不是因为有特殊的字符在文本框里呢?
那就加上server.htmlencode编码及server.htmldecode解码:

protected   void   page_load(object   sender,   eventargs   e)
{
if   (!this.ispostback)
{
string   seach   =   server.htmldecode(this.request.querystring[ "seach "]);
}
}
protected   void   button1_click(object   sender,   eventargs   e)
{
response.redirect( "login.aspx?id=3&seach= "   +   server.htmlencode(this.textbox1.text));
}
发表于:2007-03-16 14:37:3419楼 得分:0
把this去掉试试
发表于:2007-03-16 14:39:5320楼 得分:0
this.textbox1.text   是否为只读?
偶以前也遇到过。
发表于:2007-03-16 14:40:3121楼 得分:0
先把报的什么错误拿出来看看
发表于:2007-03-16 15:27:0322楼 得分:0
试试这个response.redirect( "seachban.aspx?id=3&seach= ' "+this.textbox1.text.tostring()+ " ' ");
发表于:2007-03-16 15:58:4123楼 得分:0
把   web.config   里面的编码设置为gb2312
发表于:2007-03-16 16:10:0624楼 得分:0
up
发表于:2007-03-16 16:24:5725楼 得分:0
up
发表于:2007-03-16 16:28:2626楼 得分:0
jf
发表于:2007-03-16 16:28:4027楼 得分:0
(:
发表于:2007-03-16 16:31:4528楼 得分:0
up
发表于:2007-03-16 16:50:2329楼 得分:0
支持
发表于:2007-03-16 17:02:3430楼 得分:0
分发的多就是不一样,哈哈,我去试试
发表于:2007-03-16 17:07:2031楼 得分:0
这样写没错啊...
错误肯定不是出在这行代码上,
lz还是检查检查吧
发表于:2007-03-16 17:40:0432楼 得分:0
不会是不支持中文输入,你改用字母应该好用!
发表于:2007-03-16 20:22:2533楼 得分:0


会不会是   form   的   method=post

发表于:2007-03-16 20:41:4234楼 得分:0
写法没错,
1.调试看一下是不是textbox1本来就是空的
2.如果textbox1不是空的就看看if   (!this.ispostback)有没加

发表于:2007-03-16 20:53:5335楼 得分:0
up


快速检索

最新资讯
热门点击