Visar inlägg med etikett Ajax. Visa alla inlägg
Visar inlägg med etikett Ajax. Visa alla inlägg

fredag 16 maj 2008

Problem with $find on TabContainer using Master Pages

If you've placed your TabContainer on a page using a Master page you can't get the behaviour of the TabContainer the usual way (which would work on a page without master):

var tabContainer = $find('TabContainer1');

Therefore, if your page has a Master Page you must instead use the $get method and send the UniqueId of the TabContainer as a parameter. Through the retrurned object, you can get the control object which represents the behaviour of the TabContainer:

var tabContainer = $get('<%= this.TabContainer1.ClientID%><%= TabPassengerInfo.ClientID%>').control;

fredag 5 oktober 2007

ASP.NET Ajax History control example

This is a short example how to set up the History control from ASP.NET Futures and ASP.NET AJAX.

<cc1:History ID="History1" runat="server"></cc1:History>

<asp:UpdatePanel ID="updPnl" runat="server" UpdateMode="Always" ChildrenAsTriggers="true">

<ContentTemplate>

<asp:MultiView ID="multiView" runat="server">

<asp:View id="viewStep1" runat="server">

...

</asp:View>

<asp:View ID="viewStep1" runat="server">

...

</asp:View>

</asp:MultiView>

</ContentTemplate>

<Triggers>

<asp:AsyncPostBackTrigger ControlID="History1" EventName="Navigate" />

</Triggers>

</asp:UpdatePanel>

Event that is fired when you press the back button.

public void History1_Navigate(object sender, Microsoft.Web.Preview.UI.Controls.HistoryEventArgs args)

{

string viewId = "";

View historyView = viewStep1;

if (args.State.ContainsKey("BookingSteps"))

{

viewId = (string)args.State["BookingSteps"];

}

foreach (View v in multiView.Views)

{

if (v.ID == viewId)

historyView = v;

}

setActiveView(historyView);

}

Set history point each time you change the view.

private void setActiveView(View view)

{

multiView.SetActiveView(view);

History1.AddHistoryPoint("BookingSteps", view.ID);

}

torsdag 20 september 2007

Using ToolkitScriptManager CombineScripts with url rewrite

When you use HttpModule to handle generated htm url's the ToolscriptsMangers CombineScript dosn't work.

To fix this you can add the CombineScriptsHandlerUrl and set this value to "/".

<ajaxtoolkit:toolkitscriptmanager id="ToolkitScriptManager1" runat="server" asyncpostbacktimeout="900" combinescripts="true" combinescriptshandlerurl="/" loadscriptsbeforeui="true">

AjaxControlToolkit: Events inside a Accordion

If you having problems with needing to click twice or more on a button inside a AccordionPane to get the Event to fire this is a workaround for you.

In this example we have the following structure.


  • MasterPage

    • Page

      • MyAccordion

        • MyUserControl

          • MyButton

In the Page OnInit you simply put the following line:

LinkButton btn =(LinkButton)(MyAccordion.Panes[0].FindControl("MyUserControl").FindControl("MyButton"));

This will make the Accordion to force to load the OnInit in MyUserControl and thus register the MyButton_Click event. It will also enable all other events inside the usercontrol

Hopefully a fix for this will come in a later version of the AjaxControlToolkit.

Reference: http://forums.asp.net/t/1047516.aspx