2011-08-16 43 views
0

在Ajaxcontroltoolkit網站,他們做了很多異步upates在其標籤Ajaxcontroltookit網站如何重新加載標籤文本異步?

例如:http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/CascadingDropDown/CascadingDropDown.aspx

在這個網站上,如果您選擇奧迪 - > S4 - >金屬,低於這個下拉菜單標籤自動更新(之前:[沒有提供任何迴應]後:你選擇了一個Azure奧迪A4。尼斯車!)

任何人都可以分享一個簡單的例子,如何做到這一點?

+0

你問AJAX是如何工作的,或只是功能的特定的作品呢? –

回答

0

from the ajaxcontrol toolkit sample project

protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e) 
{ 
    // Get selected values 
    string make = DropDownList1.SelectedItem.Text; 
    string model = DropDownList2.SelectedItem.Text; 
    string color = DropDownList3.SelectedItem.Text; 

    // Output result string based on which values are specified 
    if (string.IsNullOrEmpty(make)) 
    { 
     Label1.Text = "Please select a make."; 
    } 
    else if (string.IsNullOrEmpty(model)) 
    { 
     Label1.Text = "Please select a model."; 
    } 
    else if (string.IsNullOrEmpty(color)) 
    { 
     Label1.Text = "Please select a color."; 
    } 
    else 
    { 
     Label1.Text = string.Format("You have chosen a {0} {1} {2}. Nice car!", color, make, model); 
    } 
}