Showing posts with label service. Show all posts
Showing posts with label service. Show all posts

Wednesday, March 28, 2012

How do I make atlas pages pass W3C Validator?

Whenever I try to validate asp.net pages with atlas controls on the W3C Validation Service I get errors like this:

ErrorLine 506 column 19:there is no attribute "xmlns:script".
<page xmlns:script="http://schemas.microsoft.com/xml-script/2005" xmlns:atlascon

and

ErrorLine 506 column 93:there is no attribute "xmlns:atlascontrolextender".
...ipt/2005" xmlns:atlascontrolextender="atlascontrolextender" xmlns:atlascontro

I was really surprised this didn't work especially when it says at the top that it has imported these namespaces:

http://schemas.microsoft.com/xml-script/2005atlascontrolextenderatlascontroltoolkit

Is there something that I'm supposed to do to make this work that I'm missing?

I'm not an expert, but Ithink that if you were to convert all XML script tags inside the (XHTML) <script> tag to be prefixed with script:, it would work. E.g.:

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

How do do this, though, is anyone's guess :(.

Saturday, March 24, 2012

How do I acces profiles from a web service called from Atlas?

I have a web service that is called by a page that employs Atlas. I was wondering if there is a way to access the profile of the user from the webservice?

I'm trying to use HttpContext.Current.Profile.GetPropertyValue() but it's returning empty data. Is there anything that I have to set up?

Hi Zephyr,

Can you check to see whether the User.Identity.Name property is available in your web-service? This will indicate whether the user is logged in when the web-service is called. My guess is that they aren't - which is why the Profiloe is coming back null.

Thanks,

Scott

How can i use dataSource control, let it binding to page method but not web service

such as

<dataSource id="listDataSource" autoLoad="true" serviceURL="MyService.asmx" />

it binding to a web service named MyService.asmx,How can i binding it to a page method?

thanks

A data source can only declaratively bind to a DataService.

To bind it to other data, you can obtain the data programmatically (e.g. from a page method), and set the data property of the data source to the returned data.

Alternatively, you could directly bind the content (e.g. the ListView control) directly to the data, without using the data source control.

Thanks,

Wednesday, March 21, 2012

How can i stop my client side list view from disappearing every time i poll a web service?

I've written a page that displays some live information that is provided by a web service and then bound to a client side list view (the binding follows this example:http://atlas.asp.net/docs/Walkthroughs/GetStarted/databind.aspx). This page is updated with a client side timer that ticks every 3 seconds. The idea is that the page updates seamlessly as the web service is polled every few seconds.

This almost works, but there seems to be a delay whilst the web service is fetching the information, during which no list view is rendered. This means that every 3 seconds the table disappears momentarily, and then the new information is shown correctly. This leads to the screen looking "flickery".

My question is how can i prevent this flickering from appearing whilst the data is retrieved from the web service?

Many thanks

-Matt

Bonus Information:

Here are some code examples to make this a bit clearer. This is the code that updates the page and retrives the information from the webservice:

function PageRefreshTick() { LotItemDataService.GetInProgressLots(inProgressCallComplete); }function inProgressCallComplete(result) { document.getElementById("InProgressLotsItemListView").control.set_data(result); }
 And here are the relevant parts of the markup: 
<asp:Content ID="Content2" ContentPlaceHolderID="Zone1Content" runat="server"> <timer id="PageRefreshTimer" interval="3000" enabled="true" tick="PageRefreshTick" /> <atlas:ScriptManagerProxy id="ScriptManagerProxy" runat="server"> <services> <atlas:ServiceReference Path="LotItemDataService.asmx" /> </services> </atlas:ScriptManagerProxy><div class="ListView"> <div id="InProgressLotsItemListView"> </div> <div style="display: none;"> <div id="InProgressLotsItemListView_layoutTemplate"> <div id="InProgressLotsItemListView_layoutTemplate_templateItem"> <table border="0"> <tbody id="InProgressLotsItemListView_layoutTemplate_LotItemParent"> <tr id="InProgressLotItem" style="height: 28px; width: 599px;"> <td style="height: 28px;"> <table cellpadding="0" cellspacing="0"> <tr> <td style="width: 16px;"> <img id="InProgressIsTracked" alt="Tracked" src="../App_Themes/BCADirect/images/icons/icontracker.gif" /> </td> <td style="width: 40px;"> <a id="InProgressLotId" class="BidSessionLink"></a> </td> <td style="width: 10px;">   </td> <td style="width: 40px;"> <img id="VehicleImage" alt="VehicleImage" /> </td> <td style="width: 10px">   </td> <td style="width: 250px;"> <table> <tr> <td> <a id="InProgressCompleteDescription" class="BidSessionLink" /> </td> </tr> <tr> <td> <label id="InProgressRegistration" class="BidSessionLabel" /> </td> </tr> </table> </td> <td style="width: 10px;"> </td> <td style="width: 300px;"> <table> <tr> <td> <label id="InProgressHighestBidder" class="BidSessionLabel" /> </td> </tr> <tr> <td> <label class="BidSessionLabel">Current price: </label> <label id="InProgressCurrentPrice" class="BidSessionLabel" /> </td> </tr> </table> </td> <td style="width: 10px;">   </td> <td> <label class="BidSessionLabel" id="PlaceBidLabel">Test</label> </td> <td style="width: 100px; height: 100px;"> <label id="InProgressTimeRemaining" class="BidSessionLabel" /> </td> </tr> </table> </td> </tr> </tbody> </table> <a id="InProgress_layoutTemplate_HyperLink1" href="http://www.google.com" class="BidSessionLink"> </a> </div> </div> </div></div> <listView id="InProgressLotsItemListView" itemTemplateParentElementId="InProgressLotsItemListView_layoutTemplate_LotItemParent"> <layoutTemplate> <template layoutElement="InProgressLotsItemListView_layoutTemplate" /> </layoutTemplate> <bindings> <binding dataContext="waitingLotsItemDataSource" dataPath="data" property="data" /> </bindings> <itemTemplate> <template layoutElement="InProgressLotItem"> <image id="InProgressIsTracked"> <bindings dataPath="IsTracked" property="visible" /> </image> <hyperLink id="InProgressLotId"> <bindings> <binding dataPath="Id" property="text" /> <binding dataPath="VehicleDetailsUrl" property="navigateURL" /> </bindings> </hyperLink> <hyperLink id="InProgressCompleteDescription"> <bindings> <binding dataPath="CompleteDescription" property="text" /> <binding dataPath="VehicleDetailsUrl" property="navigateURL" /> </bindings> </hyperLink> <label id="InProgressRegistration"> <bindings> <binding dataPath="Registration" property="text" /> </bindings> </label> <label id="InProgressTimeRemaining"> <bindings> <binding dataPath="TimeRemaining" property="text" /> </bindings> </label> <label id="InProgressHighestBidder"> <bindings> <binding dataPath="HighestBidUserName" property="text" /> </bindings> </label> <label id="InProgressCurrentPrice"> <bindings> <binding dataPath="CurrentPrice" property="text" /> </bindings> </label> <label id="PlaceBidLabel"> <bindings> <binding dataPath="BidNowText" property="text" /> </bindings> </label> </template> </itemTemplate> </listView></asp:Content>

Although i didn't receive any replies through this board, I received a number of emails from my companies .net community, including this one:

The problem with the list view is a known issue with the Atlas team (not that they seem to be actively trying to fix it). I am currently working n a custom list view to try and reduce the flickering.

So there are couple of options open that you could try :-

1.Buffer your data and only redraw the list view when there is a delta in your data reducing the flicker.

2.Use the XML script data binding but draw the list view manually using atlas client side JavaScript (Here at HMV I manually create the list view using divs or a table due to the flickering issues).

3.If you are not bound to a Atlas then try http://www.telerik.com/ who has some awesome ajaxable controls that you can use.

I tried rendering the output myself with JavaScript to the innerHTML of a div tag, and this indeed fixed the problem. However this in turn introduces its own set of problems further down the line as I wanted to use animations, and using this method I have no components in the xml portion of the markup.

I guess until the underlying listview big is fixed, there is no way to move forward with this?

-Matt

How can I pass additional parameters to the web service or how can I call a method in the

I have done a ton of research in this area and there just does not seem to be a way to pass any addiional parameters to the Web Service reference in the autoextneder call. Is there a way that this can be done. In my world, the list of suggestion is dependant on other data on my web form or web user control. I had read some references that you might be able to call a method in the code behind page, however everything i have tried on this has failed. Here is a list of what I have attempted

Tried to add query string arguments to the service path property (error is thrown trying to render the page)

Tried to set the service path to a web page (aspx) and then call the code behind method (this also threw error trying to render the page)

Viewed some alternative solutions from vrious posts...however most we out of date t the current release (RC1).

I see that David Reed has an example at Infiinity Loop, however his server is unavailable at this time.

I would love for the auto extender to be able to natively support calling the code behind method of the page or user control that is using it. It would seem logical that the derived suggestion should be able to present a filtered list based on other data. It would be nice if I could pass it an array of string that represent name value pairs of data that I can then access in the web service and pass to whatever is building the list. Anyway just a suggestion...maybe the functionality is there and I just can not figure it out

Please help

>> I have done a ton of research in this area and there just does not seem to be a way to pass any addiional parameters to the Web Service reference in the autoextneder call. Is there a way that this can be done. In my world, the list of suggestion is dependant on other data on my web form or web user control.

With some digging around in the AutoCompleteExtender you may be able to modify the javascript to do this - I've never looked at it personally but that is where I would start. You would need to hijack that part that reads from the target control and add other data to the call.

>> I had read some references that you might be able to call a method in the code behind page, however everything i have tried on this has failed.

The following RC1 example of using a page method works on my system, but it's not going to solve your problem. The page method has to be static, so you won't be able to access any form data.

<%@. Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><%@. Register Assembly="BenValidationControls" Namespace="ben" TagPrefix="hauna" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title>Untitled Page</title></head><script runat="server"> [System.Web.Script.Services.ScriptMethod] [System.Web.Services.WebMethod] public static string[] AutoCompleteMethod(String prefixText, int count) { return new string[] { "foo", "baz" }; } </script><body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" /> <div> <asp:TextBox ID="TextBox1" runat="server" /> <asp:AutoCompleteExtender ID="AutoCompleteExtender1" ServiceMethod="AutoCompleteMethod" ServicePath="~/default.aspx" TargetControlID="TextBox1" MinimumPrefixLength="1" runat="server" /> </div> </form></body></html>

Thanks for the response. I am looking at modifying from the jvavascript as you have suggested. Here is also what I have found out...

First off the code behind must be in an aspx page and not in a ascx. I am not sure why that should matter but apparently it does. it would be really be nice if I could reference the code behind on either type of file. If you are trying to make a reusable control within your app with the auto complete extender then this is somewhat limiting. Also what I did not know or see document anywhere that this function needed to be static. Once I did that it started working quite well.

Thank you very much on this. This actually helped quite a bit.


You were referring to my derived AutoCompleteExtender that enables callbacks... I had some server issues but its back up and running :) This would solve your problem perfectly.

http://weblogs.asp.net/infinitiesloop/archive/2006/11/15/ASP.NET-Ajax-Beta_3A00_-AutoCompleteBehavior-without-a-Web-Service.aspx