본문 바로가기
Web Program/Asp.net Lecture

팝업창에서 부모창으로 데이타 전달

by 현이빈이 2009. 4. 3.
반응형

부모창에서 팝업을 연다.

ClientScript.RegisterStartupScript(this.GetType(), "Popup", "<script>window.open('pop_delivery.aspx','popup','width=500,height=500');</script>");


부모창의 스크립트 추가

<script language="javascript">
  function setCategory(strData, strData2)
  {    
    document.getElementById("<%= txtCategoryID.ClientID %>").value = strData;
    document.getElementById("<%= txtCategoryName.ClientID %>").value = strData2;
    //alert(strData2);
  }     
</script>



팝업에서 데이타 넘기기

ClientScript.RegisterStartupScript(this.GetType(), "Popup", "<script>opener.setCategory('" + strSelectedCateID + "','" + strCatename + "'); self.close();</script>");

반응형