After ajaxtoolkit is successfully installed, a simple example is provided to verify whether the installation is successful.
First read the results.
The confirmbuttonextender control is a pop-up window that controls other controls. It must be noted that confirmtext is displayed in the pop-up window. Targetcontrolid is used to specify the control. In this example, click the BTN button to trigger confirmbuttonextender.
< Form ID = "Form1" Runat = "Server" >
< Div >
< ASP: scriptmanager ID = "SM" Runat = "Server" >
</ ASP: scriptmanager >
< ASP: updatepanel ID = "Updatepanel1" Runat = "Server" >
< Contenttemplate >
< ASP: button ID = "BTN" Runat = "Server" Text = "OK" Onclick = "Btn_onclick" />
< ASP: Label ID = "LB2" Runat = "Server" Text = "" > </ ASP: Label >
< ASP: Label ID = "LB" Runat = "Server" > </ ASP: Label >
< Ajax: confirmbuttonextender Confirmtext = "Hello World" Targetcontrolid = "BTN" ID = "CBE" Runat = "Server" >
</ Ajax: confirmbuttonextender >
</ Contenttemplate >
</ ASP: updatepanel >
</ Div >
</ Form >
Background Code :
Code
Namespace Alex. ajaxlearning
{
Public Partial Class _ Default: system. Web. UI. Page
{
Protected Void Page_load ( Object Sender, eventargs E)
{
}
Protected Void Btn_onclick ( Object Sender, eventargs E)
{
This . Lb2.text = This . CBE. targetcontrolid. tostring ();
This . Lb. Text = This . CBE. confirmtext. tostring ();
}
}
}
There is nothing to say. In the pop-up window, the two labels read the name and displayed content of the control's target control.