Click to See Complete Forum and Search --> : [RESOLVED] Frustrated with AJAX Extensions
Nate1
04-23-2008, 03:10 AM
Im trying to AJAX Enable a Page, I have all the components
<ajax:tookit ... showing up on keypress, and no errors occurring or warnings, though the form I have placed a script manager and updatePanel on still performs conventional Postbacks, can someone please point me to what im doing wrong?
I also downloaded this http://download.microsoft.com/download/0/f/6/0f651a0f-6f2b-4497-b061-e1b2825e22e0/ToDoList-VB.zip
which uses the web.config file to Register the web extensions, though that didn't make a difference to my Project?
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI" TagPrefix="asp" %>
<%@ Register
Assembly="AjaxControlToolkit"
Namespace="AjaxControlToolkit"
TagPrefix="ajaxToolkit" %>
<asp:UpdatePanel ID="upPage" runat="server" UpdateMode="Always">
<ContentTemplate>
</ContentTemplate>
</asp:UpdatePanel>
chazzy
04-23-2008, 12:56 PM
do you have any triggers defined? if that's all of your code... the page isn't going to do much... if you look at the Default page they included in the zip, this is the important part, what forces it to use ajax:
<Triggers>
<asp:AsyncPostBackTrigger ControlID="DropDownList1" EventName="SelectedIndexChanged" />
</Triggers>
Edit: don't forget about this attribute in the DropDownList: AutoPostBack="True".
Nate1
04-23-2008, 10:51 PM
Yeah will have a look at these, though I have a project at work which the AJAX was setup by someone else, and I just place an update panel on the page and the page is AJAXed for all requests? Have looked at the source and can't see any major differences between this and my code?
Are you sure a Trigger is Required?
and does it have to be a control, could it be placed on the form of something?
Nate1
04-24-2008, 12:24 AM
I found this example which says when you use an update panel it adds n onsubmit call to every control in the panel, so I don't think thats the problem?
http://aspalliance.com/1315_AJAXenable_an_Existing_ASPNET_Web_Page.4
I did the exercise in the download this article suggests, and if you place the update panel around all the controls on the form it works with no triggers defined, if you place it around the buggrid and timer it posts back normally, though my page encapsulates all?
Any Ideas? Im slowly dissecting code
Nate1
04-24-2008, 12:33 AM
Its working now, I started copying the config settings from the demo project, it now, not sure which made it work, tried to back track but seems to keep working even after builds, so not really sure what caused the problem. But it wokrs which is great,
chazzy
04-24-2008, 12:10 PM
As I pointed out, this code
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI" TagPrefix="asp" %>
<%@ Register
Assembly="AjaxControlToolkit"
Namespace="AjaxControlToolkit"
TagPrefix="ajaxToolkit" %>
<asp:UpdatePanel ID="upPage" runat="server" UpdateMode="Always">
<ContentTemplate>
</ContentTemplate>
</asp:UpdatePanel>
Isn't actually going to do much. You don't have any controls inside of it.
As for the 2 you actually mentioned... you have to post your code to see how it's defined.
Nate1
04-24-2008, 04:11 PM
Code Looks like this:
<form id="form1" runat="server">
<asp:ScriptManager ID="smOne" EnablePartialRendering="true" runat="server" >
</asp:ScriptManager>
<asp:UpdatePanel ID="upPage" runat="server">
<ContentTemplate>
<table style="width: 100%" cellpadding="0" cellspacing="0">
<tr>
<td>
<h2 class="dead">
Listing Manager (BETA)
</h2>
</td>
<td rowspan="2">
<img style="float: right;" src="../../Images/Icons/Operations/64_Trade_Refresh.gif"
alt="" />
</td>
</tr>
<tr><td>
Own new Listings or give your listings away...
</td></tr>
</table>
<center>
<table>
<tr>
<td>
<b>My Listings</b></td>
<td>
</td>
<td>
<b>Available Listings</b></td>
</tr>
<tr>
<td rowspan="3">
<asp:ListBox EnableViewState="true" Width="340px" DataTextField="sTitle" DataValueField="iListingID"
Height="400px" ID="lbMyListings" runat="server"></asp:ListBox>
</td>
<td>
<center>
<asp:Button ID="btnmovealltoavailable" runat="server" Text=">>" /><br />
<asp:Button ID="btnmovesingletoavailable" runat="server" Text=">" /><br />
<asp:Button ID="btnmovesingletomylistings" runat="server" Text="<" /><br />
<asp:Button ID="btnmovealltomylistings" runat="server" Text="<<" />
</center>
</td>
<td>
<asp:ListBox EnableViewState="true" DataTextField="sTitle" Width="340px" DataValueField="iListingID"
Height="200px" ID="lbAvailableListings" runat="server"></asp:ListBox>
</td>
</tr>
<tr>
<td>
</td>
<td>
<b>Offered Listings</b>
</td>
</tr>
<tr>
<td>
<center>
<asp:Button ID="btnmovealltooffered" runat="server" Text=">>" /><br />
<asp:Button ID="btnmovesingletooffered" runat="server" Text=">" /><br />
<asp:Button ID="btnmovesingleofferedtomylistings" runat="server" Text="<" /><br />
<asp:Button ID="btnmoveofferedtomylistings" runat="server" Text="<<" />
</center>
</td>
<td>
<asp:ListBox DataTextField="sTitle" Width="340px" DataValueField="iListingID" Height="170px"
ID="lbOffered" runat="server"></asp:ListBox>
</td>
</tr>
<tr>
<td>
<%--<asp:button id="btnSave" Text="Save" runat="server" />--%>
</td>
<td>
</td>
<td>
<table>
<tr>
<td style="width: 150px">
offer these too...</td>
<td>
<asp:DropDownList Width="180px" ID="ddlUsers" DataTextField="sUserName" DataValueField="iUserID"
runat="server">
</asp:DropDownList></td>
</tr>
</table>
<asp:button id="btnOffer" Text="Offer Listings" runat="server" />
</td>
</tr>
</table>
<br />
<table style="width:100%">
<tr>
<td >
<center>
<input type="image" src="../../Images/Buttons/ImgBtnClose.gif" value="Close" onclick="closewin()" />
</center>
<asp:UpdateProgress ID="UpdateProgress1" runat="server">
<ProgressTemplate>
<div class="progress">
<%-- <img alt="" src="images/indicator.gif" />--%>
Updating .....
</div>
</ProgressTemplate>
</asp:UpdateProgress>
</td>
</tr>
</table>
</center>
</ContentTemplate>
</asp:UpdatePanel>
</form>
And config looks like
<add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</controls>