<div class="codetitle"> <span><a style="CURSOR: pointer" data="52381" class="copybut" id="copybut52381" onclick="doCopy('code52381')"><u>复制代</u></a></span> 代码如下:</div> <div class="codebody" id="code52381"> <br><asp:DropDownList ID="type1" runat="server" CssClass="tfont" onchange="link(this.id);" </asp:DropDownList> <br> <br> <br>関数リンク(id) <br>{ <br>var obj = document.getElementById(id); <br>var obj1 = document.getElementById('type2'); <br>変数名 = ""; <br>for(i = 0 ; i <obj.options.length i>{ <br>if(obj.options[i].selected) <br>{ <br>name = obj.options [i].値; <br>} <br>} <br>var names = deal_class.link(name).value.split(','); <br>var obj1_count = obj1.options.length <br>for (i = 0 ; i <obj1_count i>{ <br>obj1.options.remove(0); <br>} <br>for (i = 0 ; i < names.length ; i ) <BR>{ <BR>option1 = document.createElement("option"); <BR>option1.innerHTML = names[i]; <BR>obj1.appendChild(option1); <BR>} <BR>// アラート(名前); <BR>} <BR></script> <br><br>//后台代码 <br>AjaxPro.Utility.RegisterTypeForAjax(typeof(bargain_class)); //本页页面名 <br><br>//===============================ajax调用=== ================================== <br>[AjaxPro.AjaxMethod] <br>public string link(string name) <br>{ <br>文字列テキスト = ""; <br>string sql = "Management_products_class から名前を選択します。ここで pid='" name "'"; <br>DataTable dt = LinkSql.conn(sql); <br><br>for (int i = 0; i < dt.Rows.Count; i ) <br>{ <br>if (text == "") <br>{ <br>text = dt. Rows[i]["名前"].ToString(); <br>} <br>else <br>{ <br>text = "," dt.Rows[i]["name"].ToString(); <br>} <br>} <br>テキストを返します。 <br>} <br></obj1_count></obj.options.length> </div>