日期:2014-05-18  浏览次数:20467 次

。net问题
在top.aspx中有个按钮<asp:Button ID="Button1" runat="server" OnClick="Button1_Click1" Text="Button" />&nbsp;
<asp:DropDownList
  ID="DropDownList1" runat="server" >
  </asp:DropDownList>
当我点击这个按钮时 protected void Page_Load(object sender, EventArgs e)
  {
  Hashtable ht = (Hashtable)Application["ht"];
  this.DropDownList1.DataSource = ht;
  this.DropDownList1.DataTextField ="key";
  this.DropDownList1.DataValueField = "value";
  this.DropDownList1.DataBind();

   

  if (!IsPostBack)
  {
   
  Button1.Attributes.Add("onClick", "window.showModalDialog(\"showModalDialog.aspx\",\"\",\"dialogWidth:500px;dialogHeight:300px\");");  
  } 
弹出益而高页面对话框是:showModalDialog.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="showModalDialog.aspx.cs" Inherits="test" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">

  <meta http-equiv="Expires" content="0"/> 
<meta http-equiv="Cache-Control" content="no-cache"/> 
<meta http-equiv="Pragma" content="no-cache"/> 
<base target="_self"/>
</head>
<body>
  <form id="form1" runat="server">
  <div>
  &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp;
  &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
  <center> <table >
  <tr>
  <td rowspan="4" style="width: 100px">
  <asp:ListBox ID="ListBox1" runat="server" DataSourceID="SqlDataSource1" DataTextField="CODE_NAME"
  DataValueField="BASE_CODE" Height="197px" Width="185px" BackColor="#E0E0E0" ForeColor="#000040"
  SelectionMode="Multiple"></asp:ListBox></td>
  <td style="width: 58px; height: 44px;">
  </td>
  <td rowspan="4" style="width: 86px">
  <asp:ListBox ID="ListBox2" runat="server" Height="192px" Width="192px" BackColor="LightGray"
  ForeColor="#000040" SelectionMode="Multiple"></asp:ListBox></td>
  </tr>
  <tr>
  <td style="width: 58px;text-align:center; height: 27px;">
  <asp:Button ID="Button" runat="server" Text="添加" Width="56px" OnClick="Button_Click" /></td>
  </tr>
  <tr>
  <td style="w