I recently upgraded an application to AJAX 1.0 which was using ATLAS. But the AJAX parts in the application is no more supporting AJAX functionality. Infact, there is NO error (server or client side, javascript) but simply, changing any control causes post back and refresh the whole page instead of refreshing the part of the page. I created a new page in that application (very simple) and tried updated panel there, but that is also not working.
I tried the guide to move from ATLAS to AJAX and ensured the checklist provided in that, and I did 100% same things. My web.config includes ALL required configuration and setting. Here is the code I am using on ASPX page.
<asp:ScriptManagerID="ScriptManager1"runat="server">
</asp:ScriptManager>
<asp:UpdatePanelID="UpdatePanel1"runat="server"UpdateMode="conditional">
<ContentTemplate>
<asp:DropDownListID="ddlMain"runat="server"AutoPostBack="true">
<asp:ListItemText="First Item"></asp:ListItem>
<asp:ListItemText="First Item"></asp:ListItem>
<asp:ListItemText="First Item"></asp:ListItem>
<asp:ListItemText="First Item"></asp:ListItem>
<asp:ListItemText="First Item"></asp:ListItem>
<asp:ListItemText="First Item"></asp:ListItem>
<asp:ListItemText="First Item"></asp:ListItem>
</asp:DropDownList>
<br/>
</ContentTemplate>
</asp:UpdatePanel>
Does someone have any idea what is going on? Please note that there is no Javascript error on the page:
thanks,
Sameers
the updatepanel and other controls must inside the script manager.
Sathesh_pandian:
the updatepanel and other controls must inside the script manager.
no controls have to be inside the script manager actually, it just has to be present on the page.
But you should make the ddl tag like this
<asp:DropDownListID="ddlMain"runat="server">
i dont think you want autopostback set to trueYou are true that things must not be inside script manager. However, in order to make drop down list raise events, its autopostback property should be set to true. otherwise it dont work. I have tried it many times in other applications.
thanks,
Sameers
that is not the only way to raise events. you want to do an asycronous postback in your case, so the whole page does not reload. if you set updatemode for the panel to condition you can always say childrenastriggers = true, or do something like this where you define the triggers specifically. Autopostback will do full post backs and you probably dont want that
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="conditional"> <Triggers> <asp:AsyncPostBackTrigger ControlID="ddlMain" EventName="SelectedIndexChanged" /> </Triggers> <ContentTemplate> <asp:DropDownList ID="ddlMain" runat="server"> <asp:ListItem Text="First Item"></asp:ListItem> <asp:ListItem Text="Second Item"></asp:ListItem> <asp:ListItem Text="Third Item"></asp:ListItem> <asp:ListItem Text="First Item"></asp:ListItem> <asp:ListItem Text="First Item"></asp:ListItem> <asp:ListItem Text="First Item"></asp:ListItem> <asp:ListItem Text="First Item"></asp:ListItem> </asp:DropDownList>
Thanks for this suggestion, I already have tried it and its not working even in conditional or always mode. I think there is something to do with configuration settings (web.config), there are a lot of components used in the application. So there are a lot of entries in web.config. I am going to try to remove them one by one and try on what will help. I will post back with my results.
thanks,
Sameers
Ah! I got it.
It was the web.config entry
<xhtmlConformance mode="Legacy"/>
Which was causing trouble. I removed it and now everything is working fine.
Maybe, the following link is helpful for more information about the xhtmlConformance
http://weblogs.asp.net/scottgu/archive/2006/12/10/gotcha-don-t-use-xhtmlconformance-mode-legacy-with-asp-net-ajax.aspx
Thank you all guys for your suggestions.
Sameers
Just for other people who may stumble across this thread later, AutoPostback="true"will work fine in an UpdatePanel and do an asynchronous postback.
No comments:
Post a Comment