Showing posts with label back. Show all posts
Showing posts with label back. Show all posts

Wednesday, March 28, 2012

Multiple UpdatePanels with Animations

I have three UpdatePanels on a web page. Each of them has an Animation that makes them fade out and back in when updating. I have set the UpdateMode to conditional but when I update one of the panels the other two fade out and don't come back. Does any one have an idea of what's going on here?

Thanks in Advance!!!!!!

I have the same problem ...


This works for me

<body> <form id="form1" runat="server"> <asp:ScriptManager runat="server" ID="ScriptManager" /> <div> <asp:UpdatePanel runat="server" ID="up1" UpdateMode="conditional"> <ContentTemplate> 1:<%=DateTime.Now.ToLongTimeString%> </ContentTemplate> <Triggers><asp:AsyncPostBackTrigger ControlID="Button1" EventName="click" /></Triggers> </asp:UpdatePanel> <asp:UpdatePanel runat="server" ID="up2" UpdateMode="conditional"> <ContentTemplate> 1:<%=DateTime.Now.ToLongTimeString%> </ContentTemplate> <Triggers><asp:AsyncPostBackTrigger ControlID="Button2" EventName="click" /></Triggers> </asp:UpdatePanel> <asp:UpdatePanel runat="server" ID="up3" UpdateMode="conditional"> <ContentTemplate> 1:<%=DateTime.Now.ToLongTimeString%> </ContentTemplate> <Triggers><asp:AsyncPostBackTrigger ControlID="Button3" EventName="click" /></Triggers> </asp:UpdatePanel> <asp:Button runat="server" ID="Button1" Text="Button1" /> <asp:Button runat="server" ID="Button2" Text="Button2" /> <asp:Button runat="server" ID="Button3" Text="Button3" /> <ajaxToolkit:UpdatePanelAnimationExtender ID="ae" runat="server" TargetControlID="up1"> <Animations> <OnUpdated> <Color Duration="1" StartValue="#FF0000" EndValue="#ffffff" Property="style" PropertyKey="backgroundColor" /> </OnUpdated> </Animations></ajaxToolkit:UpdatePanelAnimationExtender><ajaxToolkit:UpdatePanelAnimationExtender ID="UpdatePanelAnimationExtender1" runat="server" TargetControlID="up2"> <Animations> <OnUpdated> <Color Duration="1" StartValue="#00FF00" EndValue="#ffffff" Property="style" PropertyKey="backgroundColor" /> </OnUpdated> </Animations></ajaxToolkit:UpdatePanelAnimationExtender><ajaxToolkit:UpdatePanelAnimationExtender ID="UpdatePanelAnimationExtender2" runat="server" TargetControlID="up3"> <Animations> <OnUpdated> <Color Duration="1" StartValue="#0000FF" EndValue="#ffffff" Property="style" PropertyKey="backgroundColor" /> </OnUpdated> </Animations></ajaxToolkit:UpdatePanelAnimationExtender> </div> </form></body>

Thanks!!! It works great.

Monday, March 26, 2012

Multiview control

Hi.

I used three radio button to switch among multiview control, how may I include AJAX into radio button control, so it doesn't post back when I try to change view ? I tried, it doesn't seem to work.

thanks for the help.

Hi,

You can avoid the postback by wrapping them in an UpdatePanel. For instance:

<%@. Page Language="C#" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"> protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e) { MultiView1.ActiveViewIndex = RadioButtonList1.SelectedIndex; }</script><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <div>  <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> </div> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:RadioButtonList ID="RadioButtonList1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged"> <asp:ListItem>1</asp:ListItem> <asp:ListItem>2</asp:ListItem> <asp:ListItem>3</asp:ListItem> </asp:RadioButtonList> <asp:MultiView ID="MultiView1" runat="server"> <asp:View ID="View1" runat="server"> View1</asp:View> <asp:View ID="View2" runat="server"> View2</asp:View> <asp:View ID="View3" runat="server"> View3</asp:View> </asp:MultiView> </ContentTemplate> </asp:UpdatePanel> </form></body></html>
Hope this helps.

thanks.

But, I don't understand, in the radio button, it says AutoPostBack=true. I did exactl the way you did except put radio button in the updatepanel, what is the magic for this updatepanel ?

thanks so much for the help.


That's weird. Can you show me your page?


Hi. this is my code.

<divstyle="border-bottom:dotted; border: 1px;">

<asp:MultiViewid="MultiView1"runat="server"ActiveViewIndex="0">

<asp:ViewID="View1"runat="server">

<asp:LabelID="lblMsg"runat="server"Width="273px"Font-Bold="True"ForeColor="Red"></asp:Label><br/>

<asp:TextBoxID="txtAddress"runat="server"></asp:TextBox>

<asp:LabelID="Label2"runat="server"Text="Ex. 101 Monroe St"Width="111px"></asp:Label><br/>

<asp:TextBoxID="txtZip"runat="server"></asp:TextBox>

<asp:LabelID="Label3"runat="server"Text="Ex. 20850"Width="106px"></asp:Label><br/>

<asp:TextBoxID="txtMiles"runat="server">2</asp:TextBox>

<asp:LabelID="Label4"runat="server"Text="Within Miles"Width="107px"></asp:Label><br/>

<asp:ButtonID="btnAddress"runat="server"Text="Find"OnClick="btnAddress_Click"/>

</asp:View>

<asp:ViewID="View2"runat="server">

<asp:DropDownListID="lstCities"runat="server"></asp:DropDownList><br/>

<asp:ButtonID="btnCities"runat="server"Text="Find"OnClick="btnCities_Click"/>

</asp:View>

<asp:ViewID="View3"runat="server">

<asp:DropDownListID="lstZipCode"runat="server">

</asp:DropDownList>

<asp:ButtonID="btnZip"runat="server"Text="Find"OnClick="btnZip_Click"/>

</asp:View>

</asp:MultiView>

</div>


The code you posted isn't sufficient to reproduce the issue. Can you show me more?


<divstyle="border-bottom:dotted; border: 1px;">

<asp:RadioButtonID="RadioButton1"runat="server"Text="Address"GroupName="grpSelection"AutoPostBack="true"OnCheckedChanged="RadioButton1_CheckedChanged"Font-Bold="True"ForeColor="Blue"Width="80px"checked="true"/>

<asp:RadioButtonID="RadioButton2"runat="server"Text="Cities"GroupName="grpSelection"OnCheckedChanged="RadioButton2_CheckedChanged"AutoPostBack="True"Font-Bold="True"ForeColor="Blue"Width="67px"/>

<asp:RadioButtonID="RadioButton3"runat="server"Text="Zip Code"GroupName="grpSelection"OnCheckedChanged="RadioButton3_CheckedChanged"AutoPostBack="True"Font-Bold="True"ForeColor="Blue"Width="84px"/>

</div>

<scriptlanguage="c#"runat="server">

protectedvoid RadioButton1_CheckedChanged(object sender,EventArgs e)

{

MultiView1.SetActiveView(View1);

}

protectedvoid RadioButton2_CheckedChanged(object sender,EventArgs e)

{

MultiView1.SetActiveView(View2);

}

protectedvoid RadioButton3_CheckedChanged(object sender,EventArgs e)

{

MultiView1.SetActiveView(View3);

}

</script>

thanks.


Here is the page that I made with the codes your provided, it worked fine.

<%@. Page Language="C#" %><%@. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"> protected void RadioButton1_CheckedChanged(object sender, EventArgs e) { MultiView1.SetActiveView(View1); } protected void RadioButton2_CheckedChanged(object sender, EventArgs e) { MultiView1.SetActiveView(View2); } protected void RadioButton3_CheckedChanged(object sender, EventArgs e) { MultiView1.SetActiveView(View3); } protected void btnAddress_Click(object sender, EventArgs e) { } protected void btnCities_Click(object sender, EventArgs e) { } protected void btnZip_Click(object sender, EventArgs e) { }</script><html xmlns="http://www.w3.org/1999/xhtml" ><head id="Head1" runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <div> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> </div> <asp:UpdatePanel runat="server" ID="up1"> <ContentTemplate> <div style="border-bottom:dotted; border: 1px;"><asp:MultiView id="MultiView1" runat="server" ActiveViewIndex="0"><asp:View ID="View1" runat="server"><asp:Label ID="lblMsg" runat="server" Width="273px" Font-Bold="True" ForeColor="Red"></asp:Label><br /><asp:TextBox ID="txtAddress" runat="server"></asp:TextBox><asp:Label ID="Label2" runat="server" Text="Ex. 101 Monroe St" Width="111px"></asp:Label><br /><asp:TextBox ID="txtZip" runat="server"></asp:TextBox><asp:Label ID="Label3" runat="server" Text="Ex. 20850" Width="106px"></asp:Label><br /><asp:TextBox ID="txtMiles" runat="server">2</asp:TextBox><asp:Label ID="Label4" runat="server" Text="Within Miles" Width="107px"></asp:Label><br /><asp:Button ID="btnAddress" runat="server" Text="Find" OnClick="btnAddress_Click" /></asp:View><asp:View ID="View2" runat="server"><asp:DropDownList ID="lstCities" runat="server"></asp:DropDownList><br /><asp:Button ID="btnCities" runat="server" Text="Find" OnClick="btnCities_Click" /></asp:View><asp:View ID="View3" runat="server"> <asp:DropDownList ID="lstZipCode" runat="server"></asp:DropDownList>     <asp:Button ID="btnZip" runat="server" Text="Find" OnClick="btnZip_Click" /></asp:View></asp:MultiView></div><div style="border-bottom:dotted; border: 1px;"> <asp:RadioButton ID="RadioButton1" runat="server" Text="Address" GroupName="grpSelection" AutoPostBack="true" OnCheckedChanged="RadioButton1_CheckedChanged" Font-Bold="True" ForeColor="Blue" Width="80px" checked="true" />    <asp:RadioButton ID="RadioButton2" runat="server" Text="Cities" GroupName="grpSelection" OnCheckedChanged="RadioButton2_CheckedChanged" AutoPostBack="True" Font-Bold="True" ForeColor="Blue" Width="67px" />      <asp:RadioButton ID="RadioButton3" runat="server" Text="Zip Code" GroupName="grpSelection" OnCheckedChanged="RadioButton3_CheckedChanged" AutoPostBack="True" Font-Bold="True" ForeColor="Blue" Width="84px" /></div> </ContentTemplate> </asp:UpdatePanel> </form></body></html>

Another tip is you need to make sure ajax extension is successfully installed on your machine, andnecessary entries have been added into your web.config.


thanks. let me try it out !


Hi.

just tried it. I don't have the file for AjaxControlToolkit, where may I find the file ?

thanks.


Hi.

In order to use UpdatePanel, I have to install AjaxControltoolkit, right ?

thanks.


shukuo:

Hi.

just tried it. I don't have the file for AjaxControlToolkit, where may I find the file ?

thanks.

http://www.codeplex.com/AtlasControlToolkit/Release/ProjectReleases.aspx?ReleaseId=4923


shukuo:

Hi.

In order to use UpdatePanel, I have to install AjaxControltoolkit, right ?

thanks.

No, Ajax Extension is enough.

MultiView within UpdatePanel causes PostBack... =(

The subject says it all. Due to a video playing, when new content is requested I need the page to NOT post back so the video doesn't restart. However, the page is still seeing a postback. Any ideas are welcome.

[removed by author]

Hi,

Is the video in the updatepanel?

Saturday, March 24, 2012

Need async post back from 1 user ctrl to another user ctrl in same master page.

Hi,

I have 3-4 web user ctrl in a Master page. Now this Master Page is being hosted by a page: ViewProductCategories.aspx. Among the userctrls on the MasterPage, I have got an ImageButton (asp:ImageButton) in one of the userctrl (ProductCtrl.ascx). Instances of ProductCtrl.ascx is being loaded dynamically on the ViewProductCategories.aspx dependng on the number of product under a category. So I have to dynamically assign the event handler for the image button click. What I want is: On the click of the asp:ImageButton (AddToCart) there should be a AsyncPostBack that only refreshes the CartCtrl.ascx which is another user ctrl on the same MasterPage, but not the other userctrls on the same master page. Situation is complex. Please let me know if any more info is needed.

Thanks,

Subhadip

Hi

You can check out this link for solution:AsyncPostBackTrigger from another user control

Please check out these linka for more information:

Trigger PostBack to an UpdatePanel from a separate UserControl?

Can I specify a UserControl custom event as a Trigger for update panel on Parent page?

Bubble Event from UserControl

Best Regards