实战showModalDialog返回值aspx控件

例一:参见Admin_group1.aspx

.aspx

<script>
    function postBackObject() {
        var o = window.event.srcElement;
        if (o.tagName == "INPUT" && o.type == "checkbox") //点击treeview的checkbox是触发
        {
            __doPostBack("", "");
        }
    }
</script>

<asp:TreeView ID="TreeView1" SkinId="Inbox"  Width="250" ExpandDepth="0"
ShowCheckBoxes="All"
OnTreeNodeCheckChanged="TreeView1_TreeNodeCheckChanged"                                                           
PopulateNodesFromClient="False"
onclick="postBackObject()"                                                                                                                                                                  
ShowLines="True" runat="server">
<HoverNodeStyle Font-UnderLine="True" />
<Nodes>                                                        
<asp:TreeNode  Text="功能列表" ImageUrl="../images/tree/xp/star.gif"  Value="功能列表" ShowCheckBox="false" SelectAction="None"></asp:TreeNode>                                                           
</Nodes>

</asp:TreeView>

 

.cs中

this.TreeView1.Attributes.Add("onclick", "CheckEvent()");//postBackObject()

例二弹出选择区县对话框

 <script language="javascript">
    function selectqx(strUrl)
    {
     var obj = eval('document.WorkArrange.ssqx');
     result = window.showModalDialog('chooseqxj.aspx' + strUrl, obj.value, 'dialogWidth=800px;dialogHeight=500px');  //open(可以右键)
     if (result!=null)
     {
      obj.value = result;
     }
    }

</script>

<asp:textbox id="ssqx" runat="server" ReadOnly="True" name="ssqx"></asp:textbox>

 

this.ssqx.Attributes.Add("onclick","selectqx('')");//文本框,单击文本框

 

 

你可能感兴趣的:(showModalDialog)