main.aspx.vb
    Protected Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Load

        
Dim cs As ClientScriptManager = Page.ClientScript
        
Dim cstype As Type = Me.GetType()
        
If (Not cs.IsClientScriptBlockRegistered("clientScriptDance")) Then '选择人
            Dim strScript As String = "<script>" + vbCrLf
            strScript 
+= "function OpenWin(){" + vbCrLf
            strScript 
+= "var str=window.showModalDialog('Frmstaff.aspx',document.getElementById('StaffID').value,'dialogWidth=683px;dialogHeight=510px')" + vbCrLf
            strScript 
+= "if(str!=null)  document.getElementById('StaffID').value=str" + vbCrLf
            strScript 
+= "}" + vbCrLf
            strScript 
+= "</script>" + vbCrLf
            cs.RegisterClientScriptBlock(cstype, 
"clientScriptDance", strScript)
        
End If

        
If Not IsPostBack Then
            buttStaff.Attributes.Add(
"onclick""OpenWin()")
        
End If
        SetStaffArrID()
    
End Sub


    
Private Sub SetStaffArrID()
        
Dim brr As Array
        
If InStr(Me.StaffID.Value, FIELD_SPLITOR) > 0 Then '返回人的信息
            brr = Split(Me.StaffID.Value, FIELD_SPLITOR)
            
Me.SID.Value = brr(0)
            
Me.StaffCode.Value = brr(1)
            
Me.StaffName.Value = brr(2)
            
Me.TxtOrgID.Value = brr(3)
            
Me.TxtOrgName.Value = brr(4)
            
Me.TxtDropID.value = brr(5)
            
Me.TxtDropName.Value = brr(6)
            
Me.TxtName.Text = brr(2)

        
End If

    
End Sub


hypo.aspx.vb


    Protected Sub buttOK_Click(ByVal sender As ObjectByVal e As System.EventArgs) Handles buttOK.Click
        
Dim StrID As String = ""
        
Dim StrName As String = ""
        
Dim StrCode As String = ""

        
If StrID <> "" Then
            StaffID.Value 
= StrID & FIELD_SPLITOR & StrCode & FIELD_SPLITOR & StrName & FIELD_SPLITOR & HTreeOrg.Value & FIELD_SPLITOR & HTreeOrgName.Value & FIELD_SPLITOR & hDropID.Value & FIELD_SPLITOR & hDropname.Value
        
Else
            StaffID.Value 
= ""
        
End If

        
Dim Cs As ClientScriptManager = Page.ClientScript
        
Dim cstype As Type = Me.GetType()

        
Dim strScript As String = "<script>" + vbCrLf
        strScript 
+= "window.parent.returnValue='" + StaffID.Value.Replace("'""\'"+ "'" + vbCrLf
        strScript 
+= "window.parent.close()" + vbCrLf
        strScript 
+= "</script>" + vbCrLf
        
If (Not Cs.IsClientScriptBlockRegistered("clientScriptDance")) Then
            Cs.RegisterClientScriptBlock(cstype, 
"clientScriptDance", strScript)
        
End If

    
End Sub
posted on 2006-09-11 10:52  Liangyy  阅读(267)  评论(0编辑  收藏  举报