Showing posts with label developing. Show all posts
Showing posts with label developing. Show all posts

Wednesday, March 28, 2012

Multiple Update Panel Animation Extenders on one page

Hi there!

I'm developing a web user control that contains an Update Panel and uses an Update Panel Animation Extender.
The animation is quite simple: while the panel is updating, it fades out the contents of the update panel and fades in the "please wait while processing..." message...then the animation reverses the process when the panel is Updated. The animation works quite nicely.

The problem I'm facing is when I have more than one of these web user controls on the page at a time (I'm using 8 of these on one page at a time).
If one web user control's update panel does an asynchronous postback, all of the animations are run!

Does anyone know how to get around this problem?

Thanks in advance,

-Frinny

Hi,

Would you please provide with any code of ypur usercontrol?

Or create a simple repro of this problem?

Thanks,


I forgot that I had posted this question.
I found the solution to my problem a while ago.

The problem I was describing is not actually a problem, it is how the UpdatePanelAnimationExtender works.

Anyways, to get around this problem I ended up using regular Animations instead of the UpdatePanelAnimationExtender.

Cheers!

Monday, March 26, 2012

My early adoption experiences.

Hi guys, this is my first post here.

I'm developing a Portuguese Travel Agency website, asp.net 2.0 powered backed by filemaker 7 server database.http://www.queroviagens.com is the original website without atlas features. I have atlas powered version herehttp://www.queroviagens.com/queroviagens/test.aspx with autocomplete in a textbox, and without postback having partial updates instead.

I have some triggers on 2 hidden buttons that make the choices, and in the javascript tree and other links i call a javascript function that puts in hidden textboxes the values of the selected Id's and make a button.click() so it can raise the event.

One thing i would like to do is to have distinct progressbars, one for each updatepanel, and not only one. Is it possible yet ?

Another thing: let's supose i want to update the javascript tree, and I have a webservice that returns the javascript code. I can inject that in a span but it will not load. Any javascript code is not executed. Any way to fix it ?

Thanks in advance, and happy coding

hello.

well, i'm assuming that you want 2 distinct progress bars so that the info message is different. if this is the case, you don't really need two bars since you can change what's shown with code similar to this one:

<%

@.PageLanguage="C#" %>

<!

DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<

scriptrunat="server">void h(object sender,EventArgs args)

{

info.Text = ((

Button)sender).ID +" " +DateTime.Now.ToString();

System.Threading.

Thread.Sleep(2000);

}

</

script>

<

htmlxmlns="http://www.w3.org/1999/xhtml">

<

headrunat="server"><title>Untitled Page</title>

</

head>

<

body><formid="form1"runat="server"><atlas:ScriptManagerrunat="server"id="manager"EnablePartialRendering="true"></atlas:ScriptManager><atlas:UpdatePanelrunat="server"ID="panel"><ContentTemplate><asp:Buttonrunat="server"ID="bt"Text="Submit"OnClick="h"/><asp:Literalrunat="server"ID="info"/></ContentTemplate></atlas:UpdatePanel><atlas:UpdatePanelrunat="server"ID="UpdatePanel1"><ContentTemplate><asp:Buttonrunat="server"ID="bt2"Text="Submit"OnClick="h"/><asp:Literalrunat="server"ID="Literal1"/></ContentTemplate></atlas:UpdatePanel><atlas:updateprogressrunat="server"ID="prog1"><ProgressTemplate>

progress 1

</ProgressTemplate></atlas:updateprogress><scripttype="text/xml-script">

<page xmlns:script=

"http://schemas.microsoft.com/xml-script/2005">

<components>

<button id=

"bt">

<click>

<setProperty target=

"prog1" property="associatedElement" propertyKey="innerText" value="updatePanel1" />

</click>

</button>

<button id=

"bt2">

<click>

<setProperty target=

"prog1" property="associatedElement" propertyKey="innerText" value="updatePanel2" />

</click>

</button>

</components>

</page>

</script></form>

</

body>

</

html>
Totally off-topic reply but...

I like the javascript-powered treeview for the "Escolha o Destino" menu. Is it a third-party control or...?

Thanks,

-Benton
Hi Bento. Its a free javascript script:
http://www.softcomplex.com/products/tigra_menu_tree/

But in pageload I dynamic build the tree, with contents of database, and in the link item i put a javascript function i created EscolheDestino(123);

this EscolheDestino what it does is :

function EscolheDestino(val){

var t = document.getElementById('DestinoId');
t.value=val;
document.form1.btnEscolher.click();
}

So it puts the chosen Id in a hidden textbox field (DestinoId), and forces a hidden button (btnEscolher) to be clicked. This button is in the trigger of an update panel, and the datalist with the current offers for that destination are refreshed.

The problem I have is that the .click() does not raise the Click event on firefox. I will try change it to _dopostback() function to see if it fits.

Best regards

hello again.

sorry, i don't understand? what do you mean?


It's a free javascript available at:

http://www.softcomplex.com/products/tigra_menu_tree/

In pageload i dynamically generate the tree and in the link of each node i put a javscript function

EscolheDestino(id)

function EscolheDestino(val){

var t = document.getElementById('DestinoId');
t.value=val;

document.form1.btnEscolher.click();

}

What it does is selecting an id to a hidden textfield and simulate a click on a hidden button. This button is in a trigger that refreshes the datalist control.

The only problem is that this method of using .click() in firefox does not raise the Click event :|

Saturday, March 24, 2012

Namespace registered once but used in severel Files

Hi everyone!I'm sorry for my english, it's a bit rusty, because I'm german.My problem:I am developing a custom webcontrol, which is inherited from WebCrontrol and IScriptControl. Everything works fine on codebehind (I think ;)). I have also developed 4 JS-Files.In JSFile1.js I registered my namespaces (i.e. "Sample", "Sample.Control", Sample.Collection").In JSFile2.js I DO NOT register any Namespace, but I want USE the registered namespaces. But when I start my webapplication, IE says that "Sample" is unknown in JSFile2.js. Is my way of implementation possible at all?I hope you guys understand what I want. :)Thanks and greetsPuppetMasterP.S. I'm sorry for doubleposting, haven't seen this area at first.

Sounds like you may have an issue with the order of files being added into the page. Make sure JSFile1.js comes before JSFile2.js when your page is rendered.

-Damien


I fixed the problem. It was a simple comma. One comma to much...What is it called like? "wood for the trees" or something? :)Thanks and greetsPuppetMaster

Glad you fixed it. Please mark this topic as answered / resolved.

-Damien

Need Help - UserControl Completely disappears

I'm developing an ASP.NET Ajax application in VS2005. The problem is describe bellow

Scenario
=============
I have a ASPX page with a UpdatePanel( say it is UpdatePanel_ 1) and a Button(say it is UpdatePanel_ 1_Button). Under the UpdatePanel_ 1 I have a Panel(say it is BodyPanel_1) to load different control as require.

On UpdatePanel_ 1_Button click event, it will load different UserControl in the BodyPanel_1 and then call UpdatePanel_ 1.Update() method.

Now say I have a UserControl( say it is UserControl_ 1) have a TextBox and a Button(say it is UserControl_ 1_Button). On click on the Button(UserControl_ 1_Button), add a simple text(say - "You Click Me") in the UserControl_ 1's TextBox.

Issue
==========
If I load the UserControl(UserControl_ 1) in PageLoad event it works fine.

But when I load the UserControl_ 1 on the page UpdatePanel_ 1_Button click event, it load the UserControl_ 1 but in that UserControl when I click on the UserControl' s ( The UserControl_ 1_Button ) Button the UserControl Completely disappears ( The UserControl_ 1 get vanish from the page ).

In the design mode I can drag the user control (UserControl_ 1) and at run time can do visible and invisible but it's not the solution as I like to load different controls in the same page base on some logic.

Following is my Button Click event function.
protected void UpdatePanel_ 1_Button_Click(object sender, EventArgs e)
{
//get the panel
Panel bodyPanel = (Panel)this. Page.FindControl ("BodyPanel_1");
//load the usercontrol
Control myControl = this.LoadControl( "UserControl_ 1");
myControl.ID = "45646546";
//add the usercontrol
bodyPanel.Controls. Add(myControl) ;
//update the UpdatePanel
UpdatePanel_ 1.Update();
}

The above function loads the UserControl( The UserControl_ 1), but when you click on the Button(UserControl_ 1_Button) under the UserControl, it disappears. But when I load the same UserControl in the Page Load every thing works fine.

I understand that when I load the UserControl dynamically at run time it's not register the UserControl' s events.

Please let me know your suggestion.

Thanks

Hi,

It's necessary to add the control in Page_load everytime. Please read this FAQ:

1. Why do I have to recreate dynamic controls every time? /Why dynamic controls are disappeared on PostBack?


Whenever a request comes, a new instance of the page that isbeing requested is created to serve the request even it's a PostBack. Allcontrols on the page are reinitialized, and there state can be restored fromthe ViewState in a later phase.

The dynamic controls have to be recreated again and added tothe control hierarchy. Otherwise, they won't exist in the page.

Please be careful with when to create dynamic controls. Inorder to keep their state, they have to be created before the LoadViewStatephase. Page_Init as well as Page_Load methods are options available.

For more information about this topic, please refer to thisarticle:

Creating Dynamic Data Entry User Interfaces[http://msdn2.microsoft.com/en-us/library/aa479330.aspx ]

Hope this helps.