Script does not refresh the page before and after the linkage code _javascript tips

Source: Internet
Author: User
Copy Code code as follows:

<asp:dropdownlist id= "type1" runat= "cssclass=" tfont "onchange=" link (this.id); "</asp:DropDownList>
<%--Size class--%>
<script>
function link (id)
{
var obj = document.getElementById (ID);
var obj1 = document.getElementById (' type2 ');
var name = "";
for (i = 0; i < obj.options.length; i++)
{
if (obj.options[i].selected)
{
name = Obj.options[i].value;
}
}
var names = Bargain_class.link (name). Value.split (', ');
var obj1_count = Obj1.options.length
for (i = 0; i < Obj1_count; i++)
{
Obj1.options.remove (0);
}
for (i = 0; i < names.length i + +)
{
Option1 = document.createelement ("option");
option1.innerhtml = Names[i];
Obj1.appendchild (Option1);
}
alert (names);
}
</script>

Background code
AjaxPro.Utility.RegisterTypeForAjax (typeof (Bargain_class)); Page name

===============================ajax Call =====================================
[Ajaxpro.ajaxmethod]
public string link (string name)
{
String text = "";
String sql = "SELECT name from Management_products_class where pid= '" + name + "'";
DataTable dt = linksql.conn (SQL);

for (int i = 0; i < dt. Rows.Count; i++)
{
if (Text = = "")
{
Text = dt. rows[i]["Name"]. ToString ();
}
Else
{
Text + "," + dt. rows[i]["Name"]. ToString ();
}
}
return text;
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.