Showing posts with label creating. Show all posts
Showing posts with label creating. Show all posts

Wednesday, March 28, 2012

Dificult to reproduce : problems with webpartzones inside updatePanel

Hi !

That's very dificult to reproduce.

I'm creating a new website. I'm using the default webserver of Visual Studio 2005.

The home page users master pages and has a lot of user controls. The scriptManager and the webpartmanager are in masterpage.

One of the user controls uses three panels with ColapsiblePanelExtender. It's working now, after discovered It doesn't work without documentType tag.

The user controls are inserted in the master page, including a top menu with a top banner.

In the main page I have an UpdatePanel with two webpartzones and some webparts. I also have an UpdateProgress

The problems started when I tried to put outputcache in some user controls, like header and footer of the page.

1st Problem : The webParts in the middle don't allow to change position any more. When I move the webParts, the server is contacted (UpdateProgress works), answer is received but nothing change.

This happens sometimes. First I thinked it was cache, so I take out outputcache from all user controls and tried again, inserting outputcache one by one.

So I discovered that when I get this problem, if I delete the temporary directory for this application (in ASP.NET temp folder), close the webserver (and related process) and delete the browser cache the problem disappears.

2nd Problem : After insert outputcache in some user controls, something difference started to happend - when I move one webpart it changes, but the top banner change it's position, changing the page layout!

The UpdatePanel and webparts are in default.aspx page. Default.aspx uses one masterPage. Inside this master page is the top.ascx user control. Inside this control is the banner. So, something in the page change the layout, making the banner changes Its position!

In the moment I will undo all the cache changes, one by one, trying to discover wich change created this problema, but I don't believe one of the cache changes could do this.

With all this problems, the development becames too slow.

[]'s

Dennes

Hi !

I solved the banner problem, but I still don't know why it happend.

The original HTML was like this :

<style type="text/css" title="Portal BufaloInfo"><!--#banner {position:absoluteleft:284pxtop:21pxwidth:468height:60z-index:1}--></style><div id="banner"><a href="#"><img src="images/banner_468_60.gif" width="468" height="60" border="0"></a></div>

I changed to :

<div id="banner" style="position:absolute;left:284px;top:21px;width:468;height:60;z-index:1"><a href="#"><img src="images/banner_468_60.gif" width="468" height="60" border="0"></a></div>

So, now it works. Before this change, when the style was applied to DIV tag the banner was correct, when not, the banner apears in other position.

The main question is : Why the updatePanel, after a refresh, was changing the way this style was applied ?

[]'s

Dennes


Hi !

This seems to be a problem between Alas and IE, or something like that.

After I corrected the banner problem, IE stoped to apply the style to the rest of the page, to the entire page.

Like before : The pages start correct, after UpdatePanel has communicate with the server, the style disappears.

[]'s

Dennes

difference in creating toString()

I have created a .toString() on a custom object in two ways. Is there a
significant difference between two? they both seem to work. Is there a
reason to do one instead of the other?

This is done within the class definition:

this.toString = function(){
return _Name + " at " + _Address;
}

This is outside of the class def.
ExampleNamespace.cComplexCustomerType.prototype.toString = function(){
return this.getName() + " at " + this.getAddress();
}

--
Wallace B. McClure
"The Harder I Work, the Luckier I Get."
Listen to "The ASP.NET Podcast" at http://www.aspnetpodcast.com/
Database Award: http://url123.com/vc3er
Microsoft MVP - Visual Developer ASP/ASP.NET
AspInsider
"AJAX for ASP.NET" Coming Soon!
ADO.NET Book: http://url123.com/vc2bu
865-693-3004
118 Durwood Rd.
Knoxville, TN 37922
http://www.scalabledevelopment.com/
Blog: http://weblogs.asp.net/wallym/Hi,

everything added through theprototype object is shared between instances. Thus, if you declare the toString() function by expanding prototype, you are sharing the same code, while if you declare the function using thethis pointer, you are duplicating code.

There's nothing wrong in declaring functions using this or prototype, but the thing that must be avoided is pointing to *objects* through prototype, for example arrays.

Consider the following declaration:

function myObject() {
}
myObject.prototype.myArray = new Array('Item1', 'Item2');

Now, create two instances:

var obj1 = new myObject();
var obj2 = new myObject();

Add something to obj1's array:

obj1.myArray.push('Item3_by_obj1');

and finally display the two arrays:

alert(obj1.myArray);
alert(obj2.myArray);

As you can see, both the instances shares the same reference to myArray.

Difference between ASP.NET Website and ASP.NET Ajax-enabled Website

What are the differences between creating a standard ASP.NET Website and a 'special' ASP.NET AJAX-enabled website?

What are the differences VS.NET 2005 does behind the scenes?

The "ASP.Net Website" creates a default web site to create webb apps. the "ASP.Net Ajax-enabled website" will use another template and create a "normal" web site but with the required settings in web.config that is needed and a Web Form that already have the scriptmanager on the page (ScriptManager is the control that kind of "handles" all the Ajax fetures on the page) and a reference to the ASP.Net Ajax assembly.

VS 2005 don't do anything spec behind the scenes, more than using different templates that I describe above.

Wednesday, March 21, 2012

Declarative Markup within a server control

I'm creating an address control that is utilizing Atlas in a couple of places. The first place I use it I've got the javascript functions working fine. (It auto fills the address based on the zip code.)
After the autofill, the user is allowed to type in changes as needed. I was going to use the autocomplete in the state portion, and was going to use the declarative markup similar to the HOLs. When putting two of the controls on a page I was registering two declarative blocks, and they don't work. I tested it in straight HTML outside the control and got the same result. However, in the HTML test I combined it to one block (below) and it works fine.
My problem is how to get the control to render one block of declarative markup if more than one of the same control exists.
Script

<scripttype="text/xml-script">
<page xmlns:script="http://schemas.microsoft.com/xml-script/2005">
<references>
<!-- Repath the following src attributes, using regular client relative paths as necessary -->
<add src="ScriptLibrary/AtlasUI.js" />
<add src="ScriptLibrary/AtlasControls.js" />
</references>
<components>
<textBox id="Address2_txtState">
<behaviors>
<autoComplete
completionList="completionList"
serviceURL="Services/AddressAutoComplete.asmx"
serviceMethod="GetStateList"
minimumPrefixLength="1"
completionSetCount="10"
completionInterval="500" />
</behaviors>
</textBox>
<textBox id="Address2_txtState">
<behaviors>
<autoComplete
completionList="completionList"
serviceURL="Services/AddressAutoComplete.asmx"
serviceMethod="GetStateList"
minimumPrefixLength="1"
completionSetCount="10"
completionInterval="500" />
</behaviors>
</textBox>
</components>
</page>
</script>


I don't think I exactly understand your problem. Could you maybe share the code that resulted in "two declarative blocks"?

My original design created one declarative block per server control. As long as I only have one control, that works fine. As soon as I drop the second one on the page, neither of them work because I get two blocks (below), rather than the one block needed in my original post.

<scripttype="text/xml-script">
<page xmlns:script="http://schemas.microsoft.com/xml-script/2005">
<references>
<!-- Repath the following src attributes, using regular client relative paths as necessary -->
<add src="ScriptLibrary/AtlasUI.js" />
<add src="ScriptLibrary/AtlasControls.js" />
</references>
<components>
<textBox id="Address1_txtState">
<behaviors>
<autoComplete
completionList="completionList"
serviceURL="Services/AddressAutoComplete.asmx"
serviceMethod="GetStateList"
minimumPrefixLength="1"
completionSetCount="10"
completionInterval="500" />
</behaviors>
</textBox></components>
</page>
</script>

<scripttype="text/xml-script">
<page xmlns:script="http://schemas.microsoft.com/xml-script/2005">
<references>
<!-- Repath the following src attributes, using regular client relative paths as necessary -->
<add src="ScriptLibrary/AtlasUI.js" />
<add src="ScriptLibrary/AtlasControls.js" />
</references>
<components>
<textBox id="Address2_txtState">
<behaviors>
<autoComplete
completionList="completionList"
serviceURL="Services/AddressAutoComplete.asmx"
serviceMethod="GetStateList"
minimumPrefixLength="1"
completionSetCount="10"
completionInterval="500" />
</behaviors>
</textBox></components>
</page>
</script>


Interesting. All server-side Atlas controls should render their scripttags to 1 AtlasTextWriter, which will write the contents inside asingle script tag. At least that's what it is supposed to do.
Do you have a repro that results in the code you pasted?

As I understand it, you have created a custom composite server control? How are you rendering out the declartive block? Are you just string.building? Maybe you should look into this AtlasScriptWriter the other poster mentioned.

Does anyone have any more info on this AtlasScriptWriter (or AtlasTextWriter)? Is this the recommended method for rendering custom Atlas controls?