Showing posts with label browser. Show all posts
Showing posts with label browser. Show all posts

Wednesday, March 28, 2012

Atlas with not XML-HTTP ready browser ?

Hello,

I've juste tried Atlas, I put a GridView in a <atlas:UpdatePanel> and it works perfectly, I just wonder : what if the client's browser is not XML-HTTP ready ??

It throw an error, or it just work with a postback (without using Ajax) ?

Nobody has an answer...?

Monday, March 26, 2012

Atlas UpdatePanel Browser Hang

I am currently creating a web page utilizing the April Atlas CTP. On my web page there is a dropdown list, a listbox, and two buttons for add and remove. The goal is to allow the user to select an item from the drop down and move it to the listbox. The selected item is then removed from the dropdown control. Removing an item does the same but from the listbox to the dropdown.

Here is the web page snippet:

<asp:Content ID="newJobContent" ContentPlaceHolderID="mainContentArea" runat="Server">
<atlas:ScriptManager ID="scriptManager" runat="server" EnablePartialRendering="True">
</atlas:ScriptManager>
...

<div id="artist_area" style="border: solid 1px black">
Artist(s):
<atlas:UpdatePanel ID="panelArtistDropDown" runat="server">
<ContentTemplate>
<asp:DropDownList ID="ddlArtist" runat="server" CssClass="control" Width="150">
</asp:DropDownList>
<asp:ListBox ID="lstArtist" runat="server" CssClass="control" Rows="4" Width="200"> </asp:ListBox>
</ContentTemplate>
<Triggers>
<atlas:ControlEventTrigger ControlID="btnAdd" EventName="Click" />
<atlas:ControlEventTrigger ControlID="btnRemove" EventName="Click" />
</Triggers>
</atlas:UpdatePanel>
<asp:Button ID="btnRemove" runat="server" OnClick="btnRemove_Click" Text="<" />
<asp:Button ID="btnAdd" runat="server" OnClick="btnAdd_Click" Text=">" />
<asp:CustomValidator ID="valCustArtist" runat="server" ClientValidationFunction="CheckArtist" ControlToValidate="lstArtist" ErrorMessage="You must select an artist(s)." ValidateEmptyText="True"></asp:CustomValidator>
</div
And here's the server side code:

protected void btnAdd_Click(object sender, EventArgs e)
{
ListItem li = new ListItem();

li.Value = ddlArtist.SelectedItem.Value;
li.Text = ddlArtist.SelectedItem.Text;

lstArtist.Items.Add(li);
ddlArtist.Items.Remove(li);
}
protected void btnRemove_Click(object sender, EventArgs e)
{
ListItem li = new ListItem();

li.Value = lstArtist.SelectedItem.Value;
li.Text = lstArtist.SelectedItem.Text;

ddlArtist.Items.Add(li);
ddlArtist.Items.Remove(li);
}

Here's the problem... in IE6 I can add or remove 2 items. On the third try the browser will hang. The code behind is never called. The only way to get control back is to refresh the page. With FireFox everything works great. Very strange. Has anyone experienced this? Any help would be appreciated.I've tracked down the problem. Seems like a third party tool that we use (BasicDatePicker) is causing the problem. When we remove the third party control IE works as it should. Frankly I'm not too surprised because BasicDatePicker generates a ton of javascript. Looks like I'll be coming up with a new date control ;)

Saturday, March 24, 2012

Atlas to Ajax issues

I noticed that Microsoft disabled most of my links to Atlas documentation, in particular the excellent Client Class Library Browser athttp://atlas.asp.net/docs/Client/Browser/jsBrowser.aspx that was invaluable to me in figuring out all the undocumented bits in the CTP release. So I figured I would bite the bullet and upgrade to my web app to the AJAX 1 beta... based on the 'Migration Guide' document it looked pretty painless.

Big, big mistake. It appears that the syntax of virtually every client-side AJAX call I was making has changed radically, and I can't find adequate documentation on the new syntax. I've read the white paper entitled "Changes between the ASP.NET AJAX CTP and the V1.0 Beta/RTM Release" and did not get much help from it. The excellent set of online examples for the CTP do not seem to be present for the Beta version, so I'm fishing around for help to get my app working again.

But enough whining. I'll start with my first issue and maybe I'll stumble into a epiphany moment at some point.

In my CTP app, I instantiated a AJAX 'Select' control and tied it to its associated HTML element by doing this:

 uiCompanySelect =new Sys.UI.Select($get('SelectCompany')); uiCompanySelect.initialize(); uiCompanySelect.set_textProperty('Name'); uiCompanySelect.set_valueProperty('ID'); uiCompanySelect.selectionChanged.add(OnSelectCompany);

Based on my reading of the white paper, I'm guessing that the equivalent code in the Beta release would look like this:

 $create(Sys.UI.Select, {}, {'selectionChanged':'OnSelectCompany'}, {}, $get('SelectCompany')); $get('SelectCompany').control.set_textProperty('Name'); $get('SelectCompany').control.set_valueProperty('ID');

But apparently I would be wrong... The first line ($create...) fails with "Sys.ArgumentUndefinedException. Value cannot be undefined. Parameter name:Type". Possibly it is complaining about one of the sets of empty braces in this statement... but I can't find any documentation for the '$create' command, or the Select control (assuming it still exists), or an example using the Select control, or the client class browser (which I really miss!).

Can anyone point out the error in my code, and/or point me towards any online reference for these things so I can figure them out?

Much thanks to any who respond!

John Bendiksen

JohnBen:

I noticed that Microsoft disabled most of my links to Atlas documentation, in particular the excellent Client Class Library Browser athttp://atlas.asp.net/docs/Client/Browser/jsBrowser.aspx that was invaluable to me in figuring out all the undocumented bits in the CTP release. So I figured I would bite the bullet and upgrade to my web app to the AJAX 1 beta... based on the 'Migration Guide' document it looked pretty painless.

Big, big mistake. It appears that the syntax of virtually every client-side AJAX call I was making has changed radically, and I can't find adequate documentation on the new syntax. I've read the white paper entitled "Changes between the ASP.NET AJAX CTP and the V1.0 Beta/RTM Release" and did not get much help from it. The excellent set of online examples for the CTP do not seem to be present for the Beta version, so I'm fishing around for help to get my app working again.

Totally agreed. I was spened many hours on reading and debuging Client FX, googling and talking with MVPs, to port old projects on "new" library.

Not so long away i found very funny phrase in download section:

While prompt migration to an ASP.NET AJAX Beta or later release is highly encouraged, this installer is provided for projects that cannot bemigrated immediately and that still require access to ASP.NET AJAX technology in its pre-Beta form.

JohnBen:

But enough whining. I'll start with my first issue and maybe I'll stumble into a epiphany moment at some point.

In my CTP app, I instantiated a AJAX 'Select' control and tied it to its associated HTML element by doing this:

 uiCompanySelect =new Sys.UI.Select($get('SelectCompany')); uiCompanySelect.initialize(); uiCompanySelect.set_textProperty('Name'); uiCompanySelect.set_valueProperty('ID'); uiCompanySelect.selectionChanged.add(OnSelectCompany);

Based on my reading of the white paper, I'm guessing that the equivalent code in the Beta release would look like this:

 $create(Sys.UI.Select, {}, {'selectionChanged':'OnSelectCompany'}, {}, $get('SelectCompany')); $get('SelectCompany').control.set_textProperty('Name'); $get('SelectCompany').control.set_valueProperty('ID');

First of all you need replace references on Sys.UI toSys.Preview.UI, then you shoud use Selector (new name of Select wrapper), so client wrapper shoud look like this:

uiCompanySelect = new

Sys.Preview.UI.Selector($get('SelectCompany'));

and now you dont need to initialize component i think.


And one more thing:

eventhandler now binds byadd_selectionChanged methodm but not by selectionChanged.add