Here's a general introduction to using the method (use the lable control here for example):
1. Add a ScriptManager control to the page (the use method has not yet been studied completely, the research has been complete experimental writing point experience)
2. Add a UpdatePanel control that controls no refresh (IBID.)
3. Add two Label controls in the UpdatePanel control one to add the dropdownextender extension, one to display the value taken in the last label, and a Panel control to add several LinkButton controls to the Panel control
4. All LinkButton Common A click event, used to value or trigger other events, my following example is mainly used for the value.
5. Add a Dropdownextender control to the UpdatePanel
A. Set the Dropdownextender property: TargetControlID (target control ID or object control ID) you want Dropdownextender to extend to that control, where I'm extending to the label control,
B. A extender property appears in the properties of this label control there are dropdowncontrolid here to set the panelid above
6. Add the LinkButton event added in step 3rd
Here is the code for the simple example:
Page code:
Copy Code code as follows:
<%@ Page language= "C #" autoeventwireup= "true" codefile= "Test2.aspx.cs" inherits= "Test2"%>
<%@ Register assembly= "Crystaldecisions.web, version=10.2.3600.0, Culture=neutral, publickeytoken= 692fbea5521e1304 "
Namespace= "Crystaldecisions.web" tagprefix= "CR"%>
<%@ Register assembly= "AjaxControlToolkit" namespace= "AjaxControlToolkit" tagprefix= "CC1"%>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<title>dropdownextender Simple Exercise </title>
<style type= "Text/css" >
#Panel1
{
Background: #ffcc00;
font-size:12px;
padding:0px;
Border:solid 1px;
}
#LinkButton1, #LinkButton2, #LinkButton3, #LinkButton4
{
Color: #666;
font-size:12px;
}
</style>
<body>
<form id= "Form1" runat= "Server" >
<div>
<asp:scriptmanager id= "ScriptManager1" runat= "Server" >
</asp:ScriptManager>
</div>
<br/>
<asp:updatepanel id= "UpdatePanel1" runat= "Server" >
<ContentTemplate>
<asp:label id= "Label2" runat= "Server" text= "Label" width= "129px" ></asp:label><br/>
<br/>
<asp:label id= "Label1" runat= "Server" text= "select" Width= "91px" ></asp:Label>
<asp:panel id= "Panel1" runat= "Server" width= "85px" style= "Visibility:hidden" >
<asp:linkbutton id= "LinkButton1" runat= "Server" onclick= "Lkbtn_click" > Xian </asp:linkbutton><br/>
<asp:linkbutton id= "LinkButton2" runat= "Server" onclick= "Lkbtn_click" > Shanghai </asp:linkbutton><br/>
<asp:linkbutton id= "LinkButton3" runat= "Server" onclick= "Lkbtn_click" > Shenzhen </asp:linkbutton><br/>
<asp:linkbutton id= "LinkButton4" runat= "Server" onclick= "Lkbtn_click" > Beijing </asp:linkbutton></asp: Panel>
<cc1:dropdownextender id= "DropDownExtender1" runat= "Server" dropdowncontrolid= "Panel1"
Targetcontrolid= "Label1" >
</cc1:DropDownExtender>
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>
CS File Code:
Copy Code code as follows:
Using System;
Using System.Data;
Using System.Configuration;
Using System.Collections;
Using System.Web;
Using System.Web.Security;
Using System.Web.UI;
Using System.Web.UI.WebControls;
Using System.Web.UI.WebControls.WebParts;
Using System.Web.UI.HtmlControls;
public partial class Test2:System.Web.UI.Page
{
protected void Page_Load (object sender, EventArgs e)
{
}
protected void Lkbtn_click (object sender, EventArgs e)
{
Label1.Text = ((LinkButton) sender). Text;
Label2.Text = Label1.Text;
}
}
Let's just introduce that, leader.