Request.QueryString[]的疑惑

昨天看了同事写过的一段代码.完成的功能很简单,一个人测试没有任何问题,不过多个人一起登录测试就会出现显示内容重复的问题(自己网页里显示的是比人的东西)
忙活半天排除了几种可能,最后把目标确定在客户端回调上.下面代码是在页面加载时调用的.主要是在加载时给控件节点添加一个事件(红色部分是后添加的)
        private void tvSln_Initial()
        
{
            
//this.tvSln.BeginUpdate();
            this.tvSln.Nodes.Clear();
            TreeNode topNode
=new TreeNode();
            
//topNode.Text="基础性指标";
            
//this.tvSln.Nodes.Add(topNode);
            foreach(DataRow row in ds.Tables["SLN_PJBZXMMC"].Select("FJD='_root'"))
            
{
                TreeNode tnParent=new TreeNode();
                tnParent.Text=row["XMMC"].ToString().Trim();
                tnParent.Target=row["XMID"].ToString().Trim();
                tnParent.ID=row["XMMC"].ToString().Trim()+"\" onclick=\"javascript:buttonOnclick('"+row["XMMC"].ToString().Trim()+"','"+Request.QueryString["jy"].ToString().Trim()+"');";
                tnParent.SelectedStyle.GetColor();
                tvSln.Nodes.Add(tnParent);
                LoadChildNodes(tnParent);
            }
        }

        
private void LoadChildNodes(TreeNode tn)
        
{
            
            
foreach(DataRow srow in ds.Tables["SLN_PJBZXMMC"].Select("FJD='"+tn.Target.ToString().Trim()+"'"))
            
{
                TreeNode tnChild
=new TreeNode();
                tnChild.Text
=srow["XMMC"].ToString().Trim();
                tnChild.Target
=srow["XMID"].ToString().Trim();
                tnChild.ID
=srow["XMMC"].ToString().Trim()+"\" onclick =\"javascript:buttonOnclick('"+srow["XMMC"].ToString().Trim()+"');";

                tn.Nodes.Add(tnChild);
            }

        }
问题出在获取字符串上,但是因为使用AJAX在客户端调用服务器端脚本,Request.QueryString[]就会有问题(为什么会这样???????我也不知道)
下面是要在客户端调用的方法(红色部分为修改内容)
        [AjaxPro.AjaxMethod]
        public string[]  DisplayPLBZData(string xmmcstr,string jyjxsbm
        
            string[] list=new string[12];
            string sqlstr="SELECT * FROM SLN_PJBZ Where XMMC='"+xmmcstr+"'";
            ds=tc.returnSLN_PJBZ_XMMC(sqlstr);
            string pjxz="";
            string xmms="";
            string pjyj="";
            if(ds.Tables["SLN_PJBZXMMC"].Rows.Count>0)
            
                //return "hello world1";
                list[0]=Microsoft.JScript.GlobalObject.encodeURI(ds.Tables["SLN_PJBZXMMC"].Rows[0]["XMMC"].ToString().Trim());//0
                list[1]=ds.Tables["SLN_PJBZXMMC"].Rows[0]["JGZD"].ToString().Trim();//1
                list[2]=ds.Tables["SLN_PJBZXMMC"].Rows[0]["FJD"].ToString().Trim();//2
                list[3]=ds.Tables["SLN_PJBZXMMC"].Rows[0]["FZ"].ToString().Trim();//3
                list[4]=Microsoft.JScript.GlobalObject.encodeURI(ds.Tables["SLN_PJBZXMMC"].Rows[0]["XMID"].ToString().Trim());//4
                list[5]=Microsoft.JScript.GlobalObject.encodeURI(ds.Tables["SLN_PJBZXMMC"].Rows[0]["PJXZ"].ToString().Trim());//5
                list[6]=Microsoft.JScript.GlobalObject.encodeURI(ds.Tables["SLN_PJBZXMMC"].Rows[0]["XMMS"].ToString().Trim());//6
                list[7]=Microsoft.JScript.GlobalObject.encodeURI(ds.Tables["SLN_PJBZXMMC"].Rows[0]["pjyj"].ToString().Trim());//7

                xmid=ds.Tables["SLN_PJBZXMMC"].Rows[0]["XMID"].ToString().Trim();
                xmmc=ds.Tables["SLN_PJBZXMMC"].Rows[0]["XMMC"].ToString().Trim();    
                jgzdstr=ds.Tables["SLN_PJBZXMMC"].Rows[0]["JGZD"].ToString().Trim();
                fjd=ds.Tables["SLN_PJBZXMMC"].Rows[0]["FJD"].ToString().Trim();
                fz=ds.Tables["SLN_PJBZXMMC"].Rows[0]["FZ"].ToString().Trim();
                this.Fz=fz;
                Jgzdstr=jgzdstr;
                this.Fjd=fjd;
                this.Xmid=xmid;
                pjxz=ds.Tables["SLN_PJBZXMMC"].Rows[0]["PJXZ"].ToString().Trim();
                xmms=ds.Tables["SLN_PJBZXMMC"].Rows[0]["XMMS"].ToString().Trim();
                pjyj=ds.Tables["SLN_PJBZXMMC"].Rows[0]["pjyj"].ToString().Trim();
                if(fjd.Equals("_root"))
                
                    list[8]=Microsoft.JScript.GlobalObject.encodeURI(sc.DisplayPY(jyjxsbm,"3",xmid).Trim());
                    //Response.Write(jyjxsbm.ToString()+"----"+xmid.ToString());
                }
                else
                
                    list[8]="";
                }
                string fzstr=tc.returnDJ_FZ(jyjxsbm,jgzdstr,jyjxsbm).Equals("")? "0":tc.returnDJ_FZ(jyjxsbm,jgzdstr,jyjxsbm);
                this.Pjfz=fzstr;
                list[9]=fzstr;
                if(tc.IsAppraising(jyjxsbm,jgzdstr.Trim(),jyjxsbm).Equals("yes"))
                
                    list[10]=Microsoft.JScript.GlobalObject.encodeURI(success);
                }
                else
                
                    list[10]=Microsoft.JScript.GlobalObject.encodeURI(nostr);
                }
            
            }
            return list;
        }
aspx页面文件的javascript代码如下
        <script language="javascript">
        
<!--
            
function buttonOnclick(xmmc,jyjxsbm)
            

                portfolio.Sun.SDAS.Appraiser_Single_DJ2.DisplayPLBZData(xmmc,jyjxsbm,Appraiser_Single_DJ2_CallBack);
                document.getElementById(
"labmc").innerHTML=xmmc;
            }

            
function Appraiser_Single_DJ2_CallBack(response)
            

                
var arr=new Array();
                arr
=response.value;
                
                
if(arr[2]=="_root")
                

                    
var obj=document.getElementById("AjaxPanel4");
                    document.getElementById(
"txtComment").innerText=decodeURI(arr[8]);
                    obj.disabled
=false;
                    obj.style.visibility 
="visible";
                    document.getElementById(
"txtDesription").innerText="(注意:如果已经对维度进行了评价,维度包含的要素就无需再评)\n"+decodeURI(arr[5]);
                    
                    
//txtcomment.focus();txtcomment.select();
                }

                
else
                

                    
var obj=document.getElementById("AjaxPanel4");
                    obj.disabled
=true;
                    obj.style.visibility
="hidden";
                    document.getElementById(
"txtDesription").innerText="目标要求:  \n"+decodeURI(arr[6]);
                    document.getElementById(
"txtGist").innerText=decodeURI(arr[7]);
                }

                document.getElementById(
"labmsg").innerText=decodeURI(arr[10]);
                    
var doublestr=arr[9];
                    
var obj=document.getElementsByName("rdlItemPotion");
                    
//alert(arr[9]);
                        //obj[i].disabled=true;
                        if(doublestr<=100 && doublestr >80)
                        

                            obj[
1].checked=true;
                            obj[
4].checked=false;
                            obj[
2].checked=false;
                            obj[
3].checked=false;
                        }

                        
else if(doublestr<=80 && doublestr>60 )
                        

                            obj[
2].checked=true;
                            obj[
1].checked=false;
                            obj[
4].checked=false;
                            obj[
3].checked=false
                        }

                        
else if(doublestr<=60 && doublestr>40)
                        

                            obj[
3].checked=true;
                        }

                        
else if(doublestr<=40 && doublestr>0)
                        

                            obj[
4].checked=true;
                            obj[
1].checked=false;
                            obj[
2].checked=false;
                            obj[
0].checked=false
                        }

                        
else
                        
{
                            obj[
4].checked=false;
                            obj[
1].checked=false;
                            obj[
2].checked=false;
                            obj[
3].checked=false
                        }
        
                            
            }

            
-->
        
</script>

 

posted on 2006-12-12 14:18  散步的蠕虫  阅读(850)  评论(3编辑  收藏  举报

导航