Wednesday, March 21, 2012

DropDownList and only DropDownList causes Full Page Post Back

I have a radio button list, buttons, a DropDownList within a UpdatePanel.

Buttons, RadioButtonList events work fine doing async request but..the DropDownList events causes a Full Page postback

DroDownList need some additional setting? DropDownList has some ajax limitation ? a bug?

thanks in advance,

Alexander



Can you post your code?


hi,

have you set autopostback = true for dropdown list? try to make it false

thanks,

satish.


I try it and the problem is solved.

but the control doesnt trigger events when "selected item change" and in my case..that's not a wished behavior.

thanks,

Alexander.

PD: I haven't the code now, sorry


I post the .aspx code.

The name of the control tha causes de full page post back is "dropDownListUnits"

thanks.

----------------

<%@.PageLanguage="C#"MasterPageFile="~/SinMenuDerecho.master"AutoEventWireup="true"

CodeFile="PlayerConsole.aspx.cs"Inherits="Player_PlayerConsole"Title="Tablero de Batalla"EnableViewState="true"%>

<%@.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="cc1" %>

<%@.RegisterAssembly="GMaps"Namespace="Subgurim.Controles"TagPrefix="cc1" %>

<asp:ContentID="Content1"ContentPlaceHolderID="mainContent"runat="Server">

<asp:ScriptManagerID="ScriptManager1"runat="server">

</asp:ScriptManager>

<divstyle="text-align: center">

<divstyle="text-align: center">

<tablestyle="height: 350px; width: 900px">

<tr>

<tdstyle="width: 871px; vertical-align: top;">

<div>

<cc1:GMapID="GMap1"runat="server"enableServerEvents="True"Height="489px"OnClick="GMap1_Click"

Width="672px"/>

</div>

</td>

<tdstyle="vertical-align: top">

<asp:UpdatePanelID="UpdatePanel1"runat="server">

<contenttemplate>

<TABLEstyle="WIDTH: 100%; HEIGHT: 100%"><TBODY><TR><TDstyle="VERTICAL-ALIGN: bottom; TEXT-ALIGN: left"><TABLEstyle="WIDTH: 100%; HEIGHT: 100%"><TBODY><TR><TDstyle="WIDTH: 100px"><asp:Labelstyle="FONT-WEIGHT: bold; FONT-SIZE: 10pt"id="LblGeneral"runat="server"Width="200px"ToolTip="Informaci¢n General de la Batalla"Text="Batalla"CssClass="headerstyle"></asp:Label></TD><TDstyle="WIDTH: 100px"><asp:ImageButtonid="ImageButtonGeneral"onclick="ImageButtonGeneral_Click"runat="server"ImageUrl="~/App_Themes/BattleTheme/collapse.jpg"></asp:ImageButton></TD></TR></TBODY></TABLE></TD></TR><TR><TD><asp:Panelid="PanelGeneral"runat="server"Width="100%"Height="50px">

<tablestyle="width: 100%; height: 100%; text-align: left">

<tr>

<tdstyle="font-size: 10pt; font-family: Verdana; font-weight: bold; width: 34px;

height: 18px;">

Id</td>

<tdstyle="height: 18px">

<asp:LabelID="LblGeneralBatalla"runat="server"></asp:Label>

</td>

</tr>

<tr>

<tdstyle="font-weight: bold">

<spanstyle="font-size: 10pt">Tipo</span>

</td>

<td>

<asp:LabelID="LblGeneralTipoBatalla"runat="server"></asp:Label></td>

</tr>

<tr>

<tdstyle="font-weight: bold">

<spanstyle="font-size: 10pt">Turno</span></td>

<td>

<asp:LabelID="LblGeneralTurno"runat="server"></asp:Label></td>

</tr>

<tr>

<tdstyle="font-weight: bold;">

Estado</td>

<td>

<asp:LabelID="LblGeneralEstado"runat="server"></asp:Label></td>

</tr>

</table>

</asp:Panel><cc1:CollapsiblePanelExtenderid="CollapsiblePanelGeneralExtender"runat="server"ExpandControlID="ImageButtonGeneral"CollapseControlID="ImageButtonGeneral"TargetControlID="PanelGeneral">

</cc1:CollapsiblePanelExtender></TD></TR></TBODY></TABLE><TABLEstyle="WIDTH: 100%; HEIGHT: 100%"><TBODY><TR><TDstyle="VERTICAL-ALIGN: bottom; WIDTH: 100px; TEXT-ALIGN: left"><TABLEstyle="WIDTH: 100%; HEIGHT: 100%"><TBODY><TR><TDstyle="VERTICAL-ALIGN: bottom; WIDTH: 81px"><asp:Labelstyle="FONT-WEIGHT: bold; FONT-SIZE: 10pt"id="LblProximaAccion"runat="server"Width="200px"ToolTip="Pr¢xima Acci¢n"Text="Acci¢n"CssClass="headerstyle">

</asp:Label></TD><TDstyle="WIDTH: 100px"><asp:ImageButtonid="ImageButtonAction"onclick="ImageButton1_Click"runat="server"ImageUrl="~/App_Themes/BattleTheme/collapse.jpg"></asp:ImageButton></TD></TR></TBODY></TABLE></TD></TR><TR><TDstyle="VERTICAL-ALIGN: top; WIDTH: 100px"><asp:Panelid="PanelAction"runat="server"Width="100%">

<tablestyle="width: 100%; height: 100%">

<tr>

<tdstyle="vertical-align: top; width: auto; text-align: left;">

<asp:RadioButtonListID="RadioButtonListActions"runat="server"CellPadding="0"CellSpacing="0"

AutoPostBack="True"OnSelectedIndexChanged="RadioButtonListActions_SelectedIndexChanged">

<asp:ListItemEnabled="False">Mover</asp:ListItem>

<asp:ListItemEnabled="False">Atacar</asp:ListItem>

<asp:ListItemEnabled="False"Value="PosicionarSatelite">Posicionar Satelite</asp:ListItem>

</asp:RadioButtonList>

<cc1:CollapsiblePanelExtenderID="CollapsiblePanelActionsExtender"runat="server"

TargetControlID="PanelAction"CollapseControlID="ImageButtonAction"ExpandControlID="ImageButtonAction">

</cc1:CollapsiblePanelExtender>

</td>

</tr>

</table>

</asp:Panel></TD></TR></TBODY></TABLE><TABLEstyle="WIDTH: 100%; HEIGHT: 100%"><TBODY><TR><TDstyle="VERTICAL-ALIGN: bottom; WIDTH: 100px; TEXT-ALIGN: left"><TABLEstyle="WIDTH: 100%; HEIGHT: 100%"><TBODY><TR><TDstyle="WIDTH: 100px"><asp:Labelstyle="FONT-WEIGHT: bold; FONT-SIZE: 10pt"id="lblUnidad"runat="server"Width="200px"ToolTip="Mis unidades"Text="Unidades"CssClass="headerstyle"></asp:Label></TD><TDstyle="WIDTH: 100px"><asp:ImageButtonid="ImageButtonUnidad"onclick="ImageButtonUnidad_Click"runat="server"ImageUrl="~/App_Themes/BattleTheme/collapse.jpg"></asp:ImageButton></TD></TR></TBODY></TABLE></TD></TR><TR><TD><asp:Panelstyle="TEXT-ALIGN: left"id="PanelUnidad"runat="server"Width="100%"> <asp:DropDownListid="dropDownListUnits"runat="server"OnSelectedIndexChanged="DropDownListUnits_SelectedIndexChanged"AutoPostBack="True"DataValueField="Id"DataTextField="UnitDescription"DataSourceID="PlayerUnitsDataSource">

</asp:DropDownList><asp:ObjectDataSourceid="PlayerUnitsDataSource"runat="server"TypeName="PlayerUnitsDataSource"SelectMethod="GetPlayerUnits">

<SelectParameters>

<asp:QueryStringParameterDefaultValue="null"Name="battleID"QueryStringField="BattleID"

Type="Int32"/>

</SelectParameters>

</asp:ObjectDataSource> <TABLEstyle="WIDTH: 100%"><TBODY><TR><TDstyle="WIDTH: 100px"><STRONG>Info de la Unidad Seleccionada:</STRONG></TD></TR></TBODY></TABLE><BR/><TABLEstyle="WIDTH: 100%"><TBODY><TR><TDstyle="WIDTH: 37px"><STRONG>ID</STRONG></TD><TDstyle="WIDTH: 100px"><asp:Labelid="LblUnidadID"runat="server"></asp:Label></TD></TR><TR><TDstyle="WIDTH: 37px"><STRONG>Tipo</STRONG></TD><TDstyle="WIDTH: 100px"><asp:Labelid="LblUnidadTipo"runat="server"></asp:Label></TD></TR><TR><TDstyle="WIDTH: 37px"><STRONG>Posici¢n</STRONG></TD><TDstyle="WIDTH: 100px"><asp:Labelid="LblUnidadPosicion"runat="server"></asp:Label></TD></TR></TBODY></TABLE></asp:Panel><cc1:CollapsiblePanelExtenderid="CollapsiblePanelUnidadExtender"runat="server"ExpandControlID="ImageButtonUnidad"CollapseControlID="ImageButtonUnidad"TargetControlID="PanelUnidad">

</cc1:CollapsiblePanelExtender></TD></TR></TBODY></TABLE><TABLEstyle="WIDTH: 100%; HEIGHT: 100%"><TBODY><TR><TDstyle="VERTICAL-ALIGN: bottom; WIDTH: 100px; TEXT-ALIGN: left"><TABLEstyle="WIDTH: 100%; HEIGHT: 100%"><TBODY><TR><TDstyle="WIDTH: 100px"><asp:Labelstyle="FONT-WEIGHT: bold; FONT-SIZE: 10pt"id="LabelPlayers"runat="server"Width="200px"ToolTip="Jugadores de la batalla"Text="Jugadores"CssClass="headerstyle"></asp:Label></TD><TDstyle="WIDTH: 100px"><asp:ImageButtonid="ImageButtonPlayers"onclick="ImageButtonPlayers_Click"runat="server"ImageUrl="~/App_Themes/BattleTheme/collapse.jpg"></asp:ImageButton></TD></TR></TBODY></TABLE> </TD></TR><TR><TD><asp:Panelstyle="TEXT-ALIGN: left"id="PanelPlayers"runat="server"Width="100%">

<asp:ListBoxID="ListBoxPlayers"runat="server"DataSourceID="BattlePlayersDataSource"

DataTextField="UserName"DataValueField="PlayerID"></asp:ListBox><asp:ObjectDataSource

ID="BattlePlayersDataSource"runat="server"SelectMethod="GetBattlePlayers"TypeName="BattlePlayersDataSource">

<SelectParameters>

<asp:QueryStringParameterDefaultValue="null"Name="battleID"QueryStringField="BattleID"

Type="Int32"/>

</SelectParameters>

</asp:ObjectDataSource>

</asp:Panel><cc1:CollapsiblePanelExtenderid="CollapsiblePanelPlayersExtender"runat="server"ExpandControlID="ImageButtonPlayers"CollapseControlID="ImageButtonPlayers"TargetControlID="PanelPlayers">

</cc1:CollapsiblePanelExtender></TD></TR></TBODY></TABLE><TABLEstyle="WIDTH: 100%; HEIGHT: 100%"><TBODY><TR><TDstyle="VERTICAL-ALIGN: bottom; WIDTH: 100px; HEIGHT: 33px; TEXT-ALIGN: left"><TABLEstyle="WIDTH: 100%; HEIGHT: 100%"><TBODY><TR><TDstyle="WIDTH: 100px; HEIGHT: 40px"><asp:Labelstyle="FONT-WEIGHT: bold; FONT-SIZE: 10pt"id="LblAlliances"runat="server"Width="200px"ToolTip="Alianzas de la batalla"Text="Alianzas"CssClass="headerstyle"></asp:Label></TD><TDstyle="WIDTH: 100px; HEIGHT: 40px"><asp:ImageButtonid="ImageButtonAlliances"onclick="ImageButtonAlliances_Click"runat="server"ImageUrl="~/App_Themes/BattleTheme/collapse.jpg"></asp:ImageButton></TD></TR></TBODY></TABLE></TD></TR><TR><TDstyle="HEIGHT: 69px"><asp:Panelstyle="TEXT-ALIGN: left"id="PanelAlliances"runat="server"Width="100%">

<asp:TreeViewID="TreeViewAlliances"runat="server"ImageSet="Contacts"NodeIndent="10"

AutoGenerateDataBindings="False"EnableClientScript="False"PopulateNodesFromClient="False">

<ParentNodeStyleFont-Bold="True"ForeColor="#5555DD"/>

<HoverNodeStyleFont-Underline="False"/>

<SelectedNodeStyleFont-Underline="True"HorizontalPadding="0px"VerticalPadding="0px"/>

<RootNodeStyleFont-Bold="True"/>

<NodeStyleFont-Names="Verdana"Font-Size="8pt"ForeColor="Black"HorizontalPadding="5px"

NodeSpacing="0px"VerticalPadding="0px"/>

<Nodes>

<asp:TreeNodeText="Alianzas"Value="Alianzas">

<asp:TreeNodeText="Alianza1"Value="Alianza1">

<asp:TreeNodeText="Usuario1"Value="Usuario1"></asp:TreeNode>

</asp:TreeNode>

<asp:TreeNodeText="Alianza2"Value="Alianza2">

<asp:TreeNodeText="Usuario2"Value="Usuario2"></asp:TreeNode>

<asp:TreeNodeText="Usuario3"Value="Usuario3"></asp:TreeNode>

</asp:TreeNode>

</asp:TreeNode>

</Nodes>

</asp:TreeView>

</asp:Panel><cc1:CollapsiblePanelExtenderid="CollapsiblePanelAlliancesExtender"runat="server"ExpandControlID="ImageButtonAlliances"CollapseControlID="ImageButtonAlliances"TargetControlID="PanelAlliances">

</cc1:CollapsiblePanelExtender></TD></TR></TBODY></TABLE><TABLEstyle="WIDTH: 100%; HEIGHT: 100%"><TBODY><TR><TDstyle="VERTICAL-ALIGN: bottom; WIDTH: 100px; TEXT-ALIGN: left"><TABLEstyle="WIDTH: 100%; HEIGHT: 100%"><TBODY><TR><TDstyle="WIDTH: 100px"><asp:Labelstyle="FONT-WEIGHT: bold; FONT-SIZE: 10pt"id="lblSatelite"runat="server"Width="200px"ToolTip="Satelites Disponibles del Jugador"Text="Satelites"CssClass="headerstyle"></asp:Label></TD><TDstyle="WIDTH: 100px"><asp:ImageButtonid="ImageButtonSatelite"onclick="ImageButtonSatelite_Click"runat="server"ImageUrl="~/App_Themes/BattleTheme/collapse.jpg"></asp:ImageButton></TD></TR></TBODY></TABLE></TD></TR><TR><TDstyle="HEIGHT: 69px"><asp:Panelstyle="TEXT-ALIGN: left"id="PanelSatelite"runat="server"Width="100%"> <TABLE><TBODY><TR><TDstyle="WIDTH: 122px; HEIGHT: 16px">Satelites Disponibles</TD><TDstyle="WIDTH: 100px; HEIGHT: 16px"><asp:Labelid="LblSatelliteCantidad"runat="server"></asp:Label></TD></TR><TR><TDstyle="WIDTH: 122px"></TD><TDstyle="WIDTH: 100px"></TD></TR></TBODY></TABLE></asp:Panel><cc1:CollapsiblePanelExtenderid="CollapsiblePanelSateliteExtender"runat="server"ExpandControlID="ImageButtonAlliances"CollapseControlID="ImageButtonAlliances"TargetControlID="PanelSatelite">

</cc1:CollapsiblePanelExtender></TD></TR></TBODY></TABLE><asp:Timerid="Timer1"runat="server"Interval="5000"OnTick="Timer1_Tick"></asp:Timer><BR/>

</contenttemplate>

</asp:UpdatePanel>

</td>

</tr>

</table>

</div>

</div>

</asp:Content>


Have you set the property AutoPostBack = true" for DropDownList

Check this forum

http://forums.asp.net/p/1053484/1493464.aspx

No comments:

Post a Comment