问题描述
vs2003的代码都行,为什么在vs2008就行不通了。protectedvoidDataGrid1_DeleteCommand(objectsource,DataGridCommandEventArgse){Response.Write("<scriptlanguage="javascript">");Response.Write("functionreturntext()");Response.Write("{");//window.parent.docuent.getElementById("s").value=s;window.frames[0].document.getElementById("TextBox1").valueResponse.Write("window.dialogArguments.document.getElementById('kmbh').value='"+e.Item.Cells[1].Text.ToString().Trim().ToString()+"';");Response.Write("window.dialogArguments.document.getElementById('customer_id').value='"+DataGrid1.DataKeys[(int)e.Item.ItemIndex].ToString().Trim()+"';");Response.Write("window.close();");Response.Write("<script>self.close()</script>");Response.Write("}");Response.Write("</script>");stringjsStr;//jsStr=Response.Output.ToString();jsStr="<scriptlanguage=JavaScript>returntext();</script>";//Page.ClientScript.RegisterStartupScript(this.GetType(),"",jsStr);//Page.ClientScript.RegisterClientScriptBlock(this.GetType(),jsStr,jsStr);AlertMsg(jsStr);//this.Page.RegisterStartupScript("alert",jsStr);}protectedvoidAlertMsg(stringmsg){//this.Page.RegisterStartupScript("alert","<scriptlanguage="javascript">alert('"+msg+"');</script>");stringst=msg;ClientScriptManagercs=Page.ClientScript;cs.RegisterStartupScript(this.GetType(),"alert",st);}以上是子页源代码<basetarget="_self"/><linkhref="css/forum.css"type="text/css"rel="stylesheet"/><%Response.Expires=-1;%>以上是子页表现层代码。通过DataGrid,删除触发,选定值传入父页。父页表现源代码如下。<scriptlanguage="javascript"type="text/javascript">functionvoucherSelect(pkid){varret;ret=window.showModalDialog("selectcustomer.aspx?id="+pkid+"",window,"dialogHeight:500px;dialogWidth:690px;center:Yes;Help:No;Resizable:No;Status:Yes;Scroll:auto;Status:no;");if(ret>0)returnfalse;}</script></head><body><formid="Form1"method="post"runat="server"><tablewidth="100%"><tr><td><uc1:headerid="Header1"runat="server"></uc1:header></td></tr><tr><td><DIV>当前位置:<fontcolor="#ff0000">首页</font></DIV></td></tr><tr><tdstyle="HEIGHT:21px"><fontface="宋体">当前客户销售维护(当日)</font></td></tr><tr><tdstyle="HEIGHT:21px"><asp:textboxid="kmbh"runat="server"Width="136px"></asp:textbox><inputclass="greenbuttoncss"style="WIDTH:39px;HEIGHT:17px"onclick="voucherSelect('<%=pkid%>')"type="button"value="查找"/>
解决方案
解决方案二:
沙发,很实用,但没尝试过。
解决方案三:
解决方案四:
调试一下看看
解决方案五:
你还是直接说F12看输出什么异常了吧或者将你那个拼接后的js完整的贴出来
解决方案六:
调试没有反应。正常是单击datagrid的删除控件,就把值写入父页的文本框中。vs2003我都是这样写的,这次升级vs2008后就不行了呢?
解决方案七:
各位大大,就是aspx源码这里出错。能否提个醒Response.Write("<scripttype='text/javascript'");Response.Write("functionreturntext()");Response.Write("{");Response.Write("varparWin=window.dialogArguments");Response.Write("parWin.document.getElementById('kmbh').value='"+e.Item.Cells[1].Text.ToString().Trim().ToString()+"';");Response.Write("parWin.document.getElementById('customer_id').value='"+DataGrid1.DataKeys[(int)e.Item.ItemIndex].ToString().Trim()+"';");Response.Write("window.close();");Response.Write("}");Response.Write("</script>");stringjsStr;jsStr="<scriptlanguage=JavaScript>returntext();</script>";this.Page.ClientScript.RegisterStartupScript(this.GetType(),"alert",jsStr);
解决方案八:
客户瑞运行是正常的呀。<scripttype="text/javascript">functiongetParValues(){//接收父窗口传过的window对象.varparWin=window.dialogArguments;parWin.document.getElementById("kmbh").value="ee";parWin.document.getElementById("customer_id").value="33";window.close();//}</script>
解决方案九:
建议将js函数写到aspx页面,动态只生成调用参数,便于管理vs2008里,你建立的项目的.NET版本和原来的一样吗
解决方案十:
重新建立.net版本