2012-12-11 2 views
4

내가 구성 파일의 URL을 저장하려고에서 URL을 얻기하지만 파일 아래은 Web.config의

에서 URL을 검색 할 때 작동하지 않는 것은 웹에서 내 코드

입니다. 설정, 내 aspx.cs 페이지에서

<add key="URL" value="/NG/Viewer/ViewerSummary.aspx"/> 

을 가지고, 다음 코드를

string url = ConfigurationManager.AppSettings["URL"]; 

string strScript = "window.open(url?QueryID=" + QueryId + "', '_blank','height=650, center:yes, width=800, status=no, resizable= yes, menubar=no, toolbar=no, location=yes, scrollbars=yes, status=no');"; 
    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "strScript", strScript, true); 

바람이 위 코드를 작성하면 ow가 열리지 않지만 아래 코드를 실행하면 창이 열립니다.

string strScript = "window.open('/NG/Viewer/ViewerSummary.aspx?QueryID=" + QueryId + "', '_blank','height=650, center:yes, width=800, status=no, resizable= yes, menubar=no, toolbar=no, location=yes, scrollbars=yes, status=no');"; 
    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "strScript", strScript, true); 

어떻게 설정 파일에 값을 넣어서 창을 열 수 있습니까?
도움을 주시면 감사하겠습니다.

감사합니다.

답변

6

붙여 넣은 코드에 몇 가지 오류가있을 수 있습니다. 첫 번째 오류는 window.open에 대한 호출에서 작은 따옴표를 빠뜨린 것입니다. 다른 오류는 실제로 url 변수를 사용하고 있지 않다는 것입니다.

이 시도 :

string strScript = "window.open('" + url + "?QueryID=" + QueryId + "', '_blank','height=650, center:yes, width=800, status=no, resizable= yes, menubar=no, toolbar=no, location=yes, scrollbars=yes, status=no');"; 
0
string strScript = "window.open('" + url + "?QueryID=" + QueryId + "', '_blank','height=650, center:yes, width=800, status=no, resizable= yes, menubar=no, toolbar=no, location=yes, scrollbars=yes, status=no');"; 
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "strScript", strScript, true);