Ajax Drop Down Extender
Drop Down Extender
DropDownExtender is used to make a control DropDown when user click on another control and immediately after user select a option fromit the control dropeddown will be automatically hidden.
Used to specify the ID of the control to dropdown when user click on the target control.
The following example demonstrates how to use dropdown Extender control.
Add apage to the website and then place a Toolkit Script manager on ti and then an Image control & just below the Image control take a panel and within the panel take three linkbuttons with the captions get to Name of an Image available in your website.
Within code of the page create a method with the name linkclicked and with inthat methos write the following code.
protected void LinkClicked(object Sender,EventArgs e)
string path=”~/image/”+((LinkButton) sender).Text+”.jpg”;
With in the properties of 3 LinkButtons get the click event to name of the methos we created in the code that is ‘LinkClicked’.
Set ImageUrl Property for the Image control within the pageload event as follows to display the Image in Image Control Immediately page is loaded.
-Page Load –
Within HTML source of the page drag and DropDownExtender and set following properties to it.
<asp:DropDownExtender ID=”DropDownExtender1” runat=”server” TargetcontrolID=”Image1”DropDownControlID=”Panel1”>
At runtime when you click on the image then the panel will dropDownjust below the Image control and clicking on LinkButtion will display corresponding Image with in the ImageControl and the panel will be automatically hidden.