Showing posts with label drop. Show all posts
Showing posts with label drop. Show all posts

Wednesday, March 28, 2012

UpdateProgress Template and the Control Toolkit

I have an

atlas:UpdateProgress Template on the same page as some cascading drop downs. I have put in a large (5 seconds) delay on the webservice populating the dropdowns but still don't see the ProgressTemplate.

Does the UpdateProgress Template work with the control toolkit or is it just for UpdatePanels?

The Toolkit controls do not natively work with Atlas's UpdateProgress control. I looked into this briefly just now and it doesn't seem like the UpdateProgress control can be used in this way. Rather, it seems to tie itself directly to the "in postback" status of the relevant page. Since there are no postbacks in the CascadingDropDown scenario, UpdateProgress doesn't seem relevant. Sorry about that!

Monday, March 26, 2012

Updating multiple controls

I have an asp.net web site. I have many text boxes, drop downs and check boxes that need to be populated based on user input. I have a main text box for them to put in an ID number and a button to run my code. The problem is that the text boxes and check boxes are all over the form so I can't group them in one update panel.

Also, some of the check boxes, drop downs and text boxes can change the data in other controls based on user input. This causes so many post backs under normal conditions. If I put everything in an update panel, isn't that still going to cause just as many post backs?

Putting the whole page in one UpdatePanel will cause pretty much the same amount of data to be sent back to the server (the whole viewstate is always sent) and by the sounds of it pretty much the same amount of data comin back. It would reduce network traffic a bit and get rid of the screen flicker though.

You really need to put just the bits that update in multiple UpdatePanels, they will all get updated when one does. However, I'd go one step further and set all of them to UpdateMode="Conditional" so you can only update the panels you need to when you need to.


Thank you. I looked into that a bit further and also watched a video on multiple update panels. I will try this, conditional updates and add triggers to the update panels. Thanks again.

Wednesday, March 21, 2012

Use Atlas profile service to persist layout between sessions

This sample use Atlas profile service to persist the position of a drag and drop panel between browse sessions.

Send me a private message if you like to have a zip file includes everything for this sample.


<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<atlas:ScriptManager runat="server" ID="ScriptManager1">
<Scripts>
<atlas:ScriptReference ScriptName="AtlasUIDragDrop" />
</Scripts>
</atlas:ScriptManager>
</head>
<body>
<form id="form1" runat="server">
<span id="msg"></span>
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td width="200px" height="400px"> </td>
<td>
<div id="imagePanel" style="background-color:Navy;padding:1px">
<div id="dragHandler" style="background-color:Navy;width:100%;"></div>
<img src="http://pics.10026.com/?src=http://www.google.com/intl/en/images/logo.gif" />
</div>
</td>
</tr>
</table>
</form>

<script type="text/xml-script">
<page xmlns:script="http://schemas.microsoft.com/xml-script/2005">
<components>
<control id="imagePanel">
<behaviors>
<floatingBehavior handle="dragHandler" move="OnMove" />
</behaviors>
</control>
</components>
</page>
</script>

<script type="text/javascript">
function pageLoad()
{
Sys.Profile.set_autoSave(false);
Sys.Profile.loaded.add(onProfileLoadComplete);
Sys.Profile.saved.add(onProfileSaveComplete);
Sys.Profile.load();
}

function onProfileLoadComplete()
{
var objStyle = $object('imagePanel').element.style
objStyle.posTop = Sys.Profile.properties.poxTop;
objStyle.posLeft = Sys.Profile.properties.poxLeft;
}

function onProfileSaveComplete()
{
//alert('profile saved.');
}

function OnMove(sender, cancelArgs)
{
var ele = sender.control.element
Sys.Profile.properties.poxTop = ele.offsetTop;
Sys.Profile.properties.poxLeft = ele.offsetLeft;
Sys.Profile.save();
}
</script>
</body>
</html>

Your web.config must include something similar to the following. also you need a database to host the asp.net AppService.

<configSections>
<sectionGroup name="microsoft.web" type="Microsoft.Web.Configuration.MicrosoftWebSectionGroup">
<section name="profileService" type="Microsoft.Web.Configuration.ProfileServiceSection" requirePermission="false"/>
</sectionGroup>
</configSections>

<microsoft.web>
<profileService enabled="true"
setProperties="poxTop;poxLeft"
getProperties="poxTop;poxLeft">
</profileService>
</microsoft.web>

<connectionStrings>
<remove name="LocalSqlServer" />
<add name="LocalSqlServer" connectionString="Data Source=.\SQLExpress;Integrated Security=True;User Instance=True;AttachDBFilename=|DataDirectory|aspnetdb.mdf" />
</connectionStrings>

<system.web>
<anonymousIdentification enabled="true" />
<profile>
<properties>
<add name="poxTop" type="integer"/>
<add name="poxLeft" type="integer"/>
</properties>
</profile>
</system.web>

I'm getting javascript errors trying to use this.

Sys.Profile.loaded.add(onProfileLoadComplete);
Sys.Profile.saved.add(onProfileSaveComplete);

should be

Sys.Profile.loaded.add(onProfileLoadComplete());
Sys.Profile.saved.add(onProfileSaveComplete());

then

Sys.Profile.properties.poxTop is null or not an object.


oh...

Sys.Profile.loaded.add(onProfileLoadComplete);
Sys.Profile.saved.add(onProfileSaveComplete);

is correct. this is demo, ignore the javascript error and the second try will let you go i think.


Great Example, thanks!

2 things:

1. I changed the example slighlty to display the Profile-Save-Event Time to the StatusBar with this
Script:

window.status = Date();

Does work well, but the Date is formatted this strange way:

Fri, May 19 09:26:32 2006

So the time is in the middle of the date-part !?

2. Does anybody have the same example but working more with the Server-Side Atlas-Framework?

Thanks


please send me zip file includes everything for this sample

Hi Xiyuan Shen

Can you send me the zip file so that I can implement this...I have been partially sucessfull. It seems as though I am missing a step though.

Justin


Did you actually get this working?

I have the example loaded and it seem to initially work, however, the drag N drop page moves once the page is completely loaded, to the top left of the screen. Any ideas why?


Hi there

Here is my code. He will do the job.

You get the error "Sys.Profile... length is null" if your database, which is responsible to save and where you get the position-values, is not running or not accessible.

Good luck.

Patrick

Web.Config

<?xmlversion="1.0"?>

<configuration>

<configSections>

<sectionGroupname="microsoft.web"type="Microsoft.Web.Configuration.MicrosoftWebSectionGroup">

<sectionname="webServices"type="Microsoft.Web.Configuration.WebServicesSection"requirePermission="false"/>

<sectionname="profileService"type="Microsoft.Web.Configuration.ProfileServiceSection"requirePermission="false"/>

</sectionGroup>

</configSections>

<microsoft.web>

<!-- Enable WebServices because Profile-Service ASP.NET is accessible thru WS-->

<webServicesenableBrowserAccess="true"/>

<profileService

enabled="true"

setProperties="poxTop;poxLeft;FloatingLabelLocation"

getProperties="poxTop;poxLeft;FloatingLabelLocation">

</profileService>

</microsoft.web>

<system.web>

<authenticationmode="Windows"/>

<anonymousIdentificationenabled="true"/>

<profileenabled="true">

<properties>

<addallowAnonymous="true"name="FloatingLabelLocation"/>

<addname="poxTop"type="integer"/>

<addname="poxLeft"type="integer"/>

</properties>

</profile>

<pages>

<controls>

<addnamespace="Microsoft.Web.UI"assembly="Microsoft.Web.Atlas"tagPrefix="atlas"/>

<addnamespace="Microsoft.Web.UI.Controls"assembly="Microsoft.Web.Atlas"tagPrefix="atlas"/>

</controls>

</pages>

<compilationdebug="true" />

<httpHandlers>

<removeverb="*"path="*.asmx"/>

<!-- ASMX is mapped to a new handler so that proxy javascripts can also be served.-->

<!-- Otherwise, you get the following error-->

<!-- The HTTP verb POST used to access path '/ProfileWithAtlas/ScriptServices/Microsoft/Web/Services/Standard/ProfileWebService.asmx' is not allowed.-->

<addverb="*"path="*.asmx"type="Microsoft.Web.Services.ScriptHandlerFactory"validate="false"/>

</httpHandlers>

</system.web>

</configuration>

------------

<%@.PageLanguage="C#"AutoEventWireup="true" %>

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

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

<headrunat="server">

<title>Atlas Profiling</title>

</head>

<body>

<formid="form1"runat="server">

<atlas:ScriptManagerrunat="server"ID="ScriptManager1">

<Scripts>

<atlas:ScriptReferenceScriptName="AtlasUIDragDrop"/>

</Scripts>

</atlas:ScriptManager>

<spanid="msg"></span>

<tablecellpadding="0"cellspacing="0"border="0">

<tr>

<!-- This fixed Size is important. Without it, your d&d will not snapp-in -->

<tdstyle="width:200px;height:600px"></td>

<td>

<divid="imagePanel">

<imgid="dragHandler"src="smile.gif"alt="Smile!"/>

</div>

</td>

</tr>

</table>

<scripttype="text/xml-script">

<page xmlns:script="http://schemas.microsoft.com/xml-script/2005">

<components>

<control id="imagePanel">

<behaviors>

<floatingBehavior handle="dragHandler" move="OnMove" />

</behaviors>

</control>

</components>

</page>

</script>

<scripttype="text/javascript">

function pageLoad()

{

Sys.Profile.set_autoSave(false);

Sys.Profile.loaded.add(onProfileLoadComplete);

Sys.Profile.saved.add(onProfileSaveComplete);

Sys.Profile.load();

}

function onProfileLoadComplete()

{

var objStyle = $object('imagePanel').element.style;

if (Sys.Profile.properties.poxTop !=null)

objStyle.posTop = Sys.Profile.properties.poxTop;

if (Sys.Profile.properties.poxLeft !=null)

objStyle.posLeft = Sys.Profile.properties.poxLeft;

}

function onProfileSaveComplete()

{

window.status ="Profile saved: " + Date();

}

function OnMove(sender, cancelArgs)

{

var ele = sender.control.element;

Sys.Profile.properties.poxTop = ele.offsetTop;

Sys.Profile.properties.poxLeft = ele.offsetLeft;

Sys.Profile.save();

}

</script>

</form>

</body>

</html>