This control can be added to most ASP. NET Server controls to provide them with a drop-down menu. This drop-down menu is another control.
Here is an example:
1) Create an ASP. NET Ajax-enabled web project in Vs and name it dropdownextender1.
2) drag and drop a label control on the default. aspx page and change its text attribute to select your choice. At the same time, drag and drop a panel on the page, and drag and drop three linkbuttons in it. The view is as follows:
ItsCodeAs follows: 1 < ASP: Label ID = "Label1" Runat = "Server" Text = "Select you choice" Width = "166px" > </ ASP: Label > < BR />
2 < ASP: Panel ID = "Panel1" Runat = "Server" Height = "92px" Width = "163px" Style = "Display: hidden" >
3 < ASP: linkbutton ID = "Linkbutton1" Runat = "Server" Onclick = "Linkbutton_click" > Red </ ASP: linkbutton >
4 < BR />
5 < ASP: linkbutton ID = "Linkbutton3" Runat = "Server" Onclick = "Linkbutton_click" > Green </ ASP: linkbutton > < BR />
6 < ASP: linkbutton ID = "Linkbutton2" Runat = "Server" Onclick = "Linkbutton_click" > Blue </ ASP: linkbutton >
7 </ ASP: Panel >
3) after completing the preceding steps, drag and drop a dragdownextender on the page to set some of its attributes. The view is as follows:
the code is as follows: : dropdownextoff id =" dropdownextender1 " targetcontrolid =" label1 " dropdowncontrolid =" Panel1 " runat =" server " > MAID: dropdownextoff >
Attribute description:
Targetcontrolid: the control that needs to be bound to the dropdownextid. It has a drop-down menu.
Dropdowncontrolid: The following controls are displayed as menus.
4) Finally, drag and drop an updatepanel on the page and put a label in it to select one from the drop-down list and then display its content. The view is as follows:
5) press Ctrl + F5 to view the effect in the browser.