I'm trying to add AJAX to the following page.
http://www.skorbordz.com/Motocross/tabid/459/CategoryID/67/List/1/SortField/1/Level/a/ProductID/5/Default.aspx
The module is Catalook, which is very nice, but if you use advanced product options every product option change does a post back so I thought I could improve this with AJAX.
So, I watched a hello world AJAX Atlas tutorial, downloaded the new AJAX beta and developed my own little ajax page at www.freesis.net/test.aspx. It works fine.
I then went to Catalook and I opened the ascx file productpage.ascx. I see that all it contains is a place holder so I add a script manager, updatepanel, and contentpanel. Then moved the panel the script was loading to into that.
<
script language="javascript">
function Lookup(spage) {window.open(spage,'Lookup', 'scollbars=yes,menubar=no,height=500,width=565');}
</
script>
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:placeholder id="SkinHolder" runat="server"></asp:placeholder>
</ContentTemplate>
</asp:UpdatePanel>
<
asp:Label ID="lblAjax" width="400" Height="400" runat="server" Text="Label" Visible=false></asp:Label>
There's also a label I used to output some text when adding ajax triggers to the update panel so I could see that work.
Then I opened the code behind and dim the update panel and label as protected with evens so I could compile the dll. I also added the following MakeAJAX function that I call after the product options are loaded on page load. I had the label visible so I could see the triggers being added but it is now invisible.
here's makeajax
Private Sub MakeAjax()
Dim i As Integer
lblAjax.Text = lblAjax.Text &
"loading Ajax..."
For i = 0 To lstProductOptions.Items.Count - 1
' Obtain references to row's controls
Dim ddlOptions As DropDownList = CType(lstProductOptions.Items(i).FindControl("ddlOptions"), DropDownList)
'If ddlOptions.Visible = True Then
If ddlOptions.Items.Count > 0 Then
Dim trigger As New Microsoft.Web.UI.AsyncPostBackTrigger()
trigger.ControlID = ddlOptions.UniqueID
trigger.EventName =
"SelectedIndexChanged"
UpdatePanel1.Triggers.Add(trigger)
lblAjax.Text = lblAjax.Text & ddlOptions.UniqueID &
"..."
End If
'If ddlColors.Visible = True Then 'UserDefinedColors.Count > 0 Then
Next
End Sub
Problem is it doesn't do anything. I veiw html and compared label output and everything looks right but everything still does a postback