Showing posts with label press. Show all posts
Showing posts with label press. Show all posts

Wednesday, March 21, 2012

DropDownList displaying press SPACEBAR or ENTER to activate

This message is like the one that appears on embedded flash movies when they are not instantiated correctly.

But I am using MS AJAX and this is just a DropDownMenu. In this case I am using IE6 and the Drop Down is outside of an update panel. Pressing the spacebar activates the dropdown and it works normally.

Has anybody seen this behavior before?

sounds like you used a windows forms dropdownlist control instead of a web dropdownlist control.

check to make sure you're actually using the asp:dropdownlist

DropDownList controls doesnt show the data after postback.

I am using a FormView and ajaxToolkit:CollapsiblePanelExtender. My DropDownLists show the data the first time, but after I press a button and it does a post back, the DropDownLists does not show the data even though I can debug and see that I am adding the items in the code-behind. Please help.

<asp:FormViewID="FormView1"runat="server"DataKeyNames="ID"DataSourceID="CslaDataSource1"DefaultMode="Insert"Width="95%">

<InsertItemTemplate>

<tableborder="0"width="100%">

<tr>

<tdalign="left">

<asp:PanelID="description_HeaderPanel"runat="server"style="cursor: pointer;">

<div>

<asp:ImageButtonID="Description_ToggleImage"runat="server"ImageUrl="~/Image/plus.gif"AlternateText="collapse"/> Search

</div>

</asp:Panel>

<asp:Panelid="description_ContentPanel"runat="server"style="overflow:hidden;">

<tableborder="0">

<tr>

<tdcolspan="6"> </td>

</tr>

<tr>

<tdalign="right">Alert ID:</td>

<td><asp:TextBoxID="txtID"runat="server"Text='<%# Bind("ID") %>'/></td>

<td> </td>

<td> </td>

<td> </td>

<td> </td>

</tr>

<tr>

<tdalign="right"style="width:16.5%">Server:</td>

<tdstyle="width:16.5%"><asp:TextBoxID="txtServer"runat="server"Text='<%# Bind("Server") %>'/></td>

<tdalign="right"style="width:16.5%">Source:</td>

<tdstyle="width:16.5%">

<asp:DropDownListID="ddlSource"runat="server"SelectedValue='<%# Bind("Source") %>'>

<asp:ListItemValue="0"Text=""/>

</asp:DropDownList>

</td>

<tdalign="right"style="width:16.5%">Manager:</td>

<td>

<asp:DropDownListID="ddlManager"runat="server"SelectedValue='<%# Bind("Manager") %>'>

<asp:ListItemValue="0"Text=""/>

</asp:DropDownList>

</td>

</tr>

<tr>

<tdalign="right">Type:</td>

<td>

<asp:DropDownListID="ddlType"runat="server"SelectedValue='<%# Bind("Type") %>'>

<asp:ListItemValue="0"Text=""/>

</asp:DropDownList>

</td>

<tdalign="right">Severity:</td>

<td>

<asp:DropDownListID="ddlSeverity"runat="server"SelectedValue='<%# Bind("Severity") %>'>

<asp:ListItemValue="0"Text=""/>

</asp:DropDownList>

</td>

<tdalign="right">Detail:</td>

<td><asp:TextBoxID="txtDetail"runat="server"Text='<%# Bind("Detail") %>'/></td>

</tr>

<tr>

<tdalign="right">From:</td>

<td>

<asp:TextBoxID="txtFrom"runat="server"/> <asp:ImageButtonrunat="Server"ID="Image1"ImageUrl="~\Image\Calendar.png"AlternateText="Click to show calendar"/>

<ajaxToolkit:CalendarExtenderID="ajaxCalendar1"runat="server"TargetControlID="txtFrom"PopupButtonID="Image1"/>

</td>

<tdalign="right">To:</td>

<td>

<asp:TextBoxID="txtTo"runat="server"/> <asp:ImageButtonrunat="Server"ID="Image2"ImageUrl="~\Image\Calendar.png"AlternateText="Click to show calendar"/>

<ajaxToolkit:CalendarExtenderID="ajaxCalendar2"runat="server"TargetControlID="txtTo"PopupButtonID="Image2"/>

</td>

<td> </td>

<td> </td>

</tr>

<tr>

<tdalign="right">Status:</td>

<td>

<asp:DropDownListID="ddlStatus"runat="server"SelectedValue='<%# Bind("Status") %>'>

<asp:ListItemValue="0"Text=""/>

</asp:DropDownList>

</td>

<tdalign="right">Ticket ID:</td>

<td><asp:TextBoxID="txtTicketID"runat="server"Text='<%# Bind("Ticket") %>'/></td>

<td> </td>

<td> </td>

</tr>

<tr>

<tdcolspan="6"> </td>

</tr>

<tr>

<tdalign="center"colspan="6"><asp:ButtonID="btnSubmit"runat="server"Text="Submit"CausesValidation="false"CommandName="Insert"/></td>

</tr>

<tr>

<tdcolspan="6"> </td>

</tr>

</table>

</asp:Panel>

</td>

</tr>

</table>

<ajaxToolkit:CollapsiblePanelExtenderID="cpeSearch"runat="Server"TargetControlID="description_ContentPanel"ExpandControlID="description_HeaderPanel"CollapseControlID="description_HeaderPanel"Collapsed="true"ImageControlID="description_ToggleImage"ExpandedText="(Hide Details...)"CollapsedText="(Show Details...)"ExpandedImage="~/Image/minus.gif"CollapsedImage="~/Image/plus.gif"/>

</InsertItemTemplate>

</asp:FormView>

Hi, ensure your dropdownlistbox are only loaded on page load - try something like this:

Protected Sub Page_Load(ByVal senderAs Object,ByVal eAs System.EventArgs)Handles Me.LoadIf Not IsPostBackThen'Load the DropdownListbox with number 1 to 10Dim aAs Int16For a = 1To 10 DrpLstTest.Items.Add(a)Next aEnd If End Sub

Thanks.

That was the first thing I tried. It didn't solve the problem.

I think the problem has to do with FormView, AJAX's CollapsiblePanelExtender, and ASP.NET.

Please help!