点击弹出子页面GridView,双击选值后返回

父页面:

HTML:

再父页面的CS后台不需任何代码:

子页面:

 

HTML:


                  
                    
                       
                        
                            
                        

                    

                   

                       
                       
                           
                       

                   

   
           
     后台:CS页面:

protected void gvCompany_rowdatabound(object sender,GridVIewRowEventargs e)

{

if(e.Row.RowType==DataControlRowType.DataRow)

{
string lbCompanyID=((label)(e.Row.FindControl("lbCompanyID"))).Text.Trim();

string lbCompanyName=((label)(e.Row.FindControl("lbCompanyName"))).Text.Trim();

string returnValue=lbCompanyID+"-"+lbCompanyName;

e.Row.Attributes.Add("ondblclick","javascript:doChose('"+returnValue+"');");

//通过最下面的一句可以将GridView添加双击的事件使其双击时调用前台的doChose的方法:

 

}

}

//结束:

父页面:

HTML:

再父页面的CS后台不需任何代码:

子页面:

 

HTML:


                  
                    
                       
                        
                            
                        

                    

                   

                       
                       
                           
                       

                   

   
           
     后台:CS页面:

protected void gvCompany_rowdatabound(object sender,GridVIewRowEventargs e)

{

if(e.Row.RowType==DataControlRowType.DataRow)

{
string lbCompanyID=((label)(e.Row.FindControl("lbCompanyID"))).Text.Trim();

string lbCompanyName=((label)(e.Row.FindControl("lbCompanyName"))).Text.Trim();

string returnValue=lbCompanyID+"-"+lbCompanyName;

e.Row.Attributes.Add("ondblclick","javascript:doChose('"+returnValue+"');");

//通过最下面的一句可以将GridView添加双击的事件使其双击时调用前台的doChose的方法:

 

}

}

//结束:

你可能感兴趣的:(小技术备份,asp,string,server,javascript,html,button)