Showing posts with label installed. Show all posts
Showing posts with label installed. Show all posts

Monday, March 26, 2012

my comment on atlas (ajax) beta 1

i installed the new ctp(beta 1) and removed it and go buck to july ctp atlas

big problems that my projects fails:

1. page.clientscript.registerstartupscript - not working

insted i found some bizar fix like Microsoft.Web.Ui.Scriptmanager.RegisterStartupScript(....)

the problem with it that (allserver controls and some client click events that use 'page.clientscript.registerstartupscript' need to be updated somehow - and who has alot of server controls and alot of code it's alot of fixing and debbuging)

2. pageMethods - not working

and even the fix is no good for a system that uses pageMethods that reads data from aspx file

because the method(function) must bestatic c# /shared on vb

and becasue the need to be static

viewstate -can't exist in static function,this/Me (this.someControlName) can't exist in static function

so my suggest is (make some compatibility) to july ctp of atlas

any why i am done with this beta realese

p.s.

great job atlas team

hello.

let me add my comments:

1. it's not a bizarre fix...it's a way to ensure that everything works. it's funny that you mention that since i was under the impression that many controlos broke because the clientscriptmanager methods were used...

2. don't tell me that you were using page methods for anything...could you give me an example where you need a page method? i mean, passing everything to the server just to get a response back is not really a performant behavior...


example u ask:

there are many ways of transfering data between pages

and yes PageMethods are one of them

i transfer from child window data to parent window with pagemethods, in parent window some function

commited and creats file with all inputs from child and parent

i got pages that use this method, that's why i need pagemethod like july ctp

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

before atlas i used the dll below

and the way i use pageMethod i used this ajaxpro dll

so -compatibility - if no the have torebuild with every new ctp or beta

http://ajaxpro.schwarz-interactive.de/

did u ever used this ajax ? (link above)

before the big "atlas" of microsoft

there was some great dll called "ajax pro" byschwarz

and i build my system ajax on is dll.


hello again.

well, if you such ajax believer (which i'm not), then you surelly know that true ajax programming is on the client. this means you use javascript and xml and perform remote web method calls to get the data. pagemethod as it was presented in previous release was nonsense: you send everything back to the server just to get a result back on the server and in all cases, you really didn't need all that info that was sent back to the server. using it means wasting network bandwith. so i'm really glad they've removed it from the bits.

regarding ajax pro, nothing prevents you from still using it...

Saturday, March 24, 2012

My Web Page Is Too Big After Use Asp.Net Ajax & Control Toolkit

I installed and using the Asp.Net Ajax & Control Toolkit in my web site.I am enjoy the cool features , except for one problem : the web page became too big to open,because the script file too large(one file is 255KB).

Yes, I know if a user opened my web page once ,it will be faster ,because the script file will not download again . But I think major new visitor will not wait for 1 or 2 min to open my web .

Is any body has the same problem? And is a solution ?

Thanks a lot !

I install the Asp.net Ajax and Copy Control Toolkit dll file to my web site bin folder, and add reference it in web.

the 255KB file is :

http://www.iam2ya.com/ScriptResource.axd?d=vrvSMawp_0WGqqmTGX1asI3T2R_vAVNchQRILcRhDeu99DMl7dd3CdOiSAo_o9GSoON-VrGYckQdXYdSTjo6zEIuvurZyzx_M44XRjh_GYU1&t=633056550088536400

the Ajaxextention version is "v1.0.61025"

the Control Toolkit version is "1.0.10123.0 "

Hi,

in the web.config file, do you have debug="true"? If so, change it to false. This results in using the production client javascripts instead of the debug ones that are quite larger.

Grz, Kris.

Namespace undefined in gadget

I've developed a very simple gadget. It works on my computer well. I've installed it on LiveCom and it doesn't work. I am sure I amdoing all good, as Atlas documentation writes but I get an error.

Details: on button click I call a function (as in Atlas examples):

function DoSearch()
{
MyNamespace.MyGadgetBridge.Search(.................);
}

The error is: MyNamespace is undefined.

Also of course I have

<atlas:ScriptManager runat="server" ID="scriptManager">
<services>
<atlas:servicereference path="~/HelloWorldService.asmx" />
</services>
</atlas:ScriptManager>

Defined in Gadget:

<

Scripts><atlas:scriptreferencepath="rssgadget_wt.js"/></Scripts>

and simple bridge:

<?xml version="1.0" encoding="utf-8" ?>
<bridge namespace="MyNamespace" className="MyGadgetBridge" >
<proxy type="WSWrapper, App_Code" />
<method name="Search">
<input>
<parameter name="searchKeywords" />
</input>
</method>
</bridge>

It works on my computer. I get this error only on LiveCom, why? what is wrong?

Please help. Thank you.

hello.

can you give more info on this? i haven't tried using bridges from a gadget, but i have called remote web services without any problems by using the iframeexecutor client class...


There is all info you need I think. I am not doing anything difficult. Just the most simple example gadget with brige and javascript call. You can rework Atlas example gadget from documentation to use javascript call instead of declarative for 10 min to have call like:

function DoSearch()
{
MyNamespace.MyGadgetBridge.Search(.................);
}

The error is: MyNamespace is undefined.

This error I get on LiveCom, but woks on my computer

Maybe to install the gadget on LiveCom Microsoft should "allow" my gadget or bridge work there... I do not understand this.

Also I don't understand the process of installation of gadget on LiveCom. What files are copied? How it works from there?

In the call MyNamespace.MyGadgetBridge.Search(.................);
what bridge is called, my or that was installed on LiveCom?


hello.

well, if it's undefined, then the problem is that you're not putting the correct link on the gadget...


Mr.Luis Abreu,

Can you please give me a *hint* as to how you are executing cross domain requests using IFrameExecutor class?

It would be immensely helpful if there is any documentation.

Thanks

Indo.


hello again.

well, here's a quick example i've build a couple of months ago. it uses the amazon service, which is wrapped on a "local" web service. don't forget to uncomment the iframe handler on the web.config file. here's the code (i've built it in april and haven't run in with the latest ctp):

aspx file:

<%@. Page Language="C#" %>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<atlas:ScriptManager runat="server" ID="manager" EnableScriptComponents="false" />
<atlas:Gadget runat="server"
Description="A gadget that let's you search Amazon.com."
ID="myGadget"
Title="Book Search by author name v2">
<ContentTemplate>
<input type="text" class="text" id="_txtSearch" name="_txtSearch" value="enter the name of the book you're interested in" />
<input type="button" id="_btSearch" value="Search" onclick="handleClick()" /><p></p>
<span id="t"></span>
<div id="_content">
</div>
<div id="_panel">
</div>
</ContentTemplate>
<Services>
<atlas:ServiceReference Path="AmazonHelper.asmx" />
</Services>
<Styles>
<atlas:StyleReference Path="~/cap12/livroatlasgadgetv2.css" />
</Styles>
<Scripts>
<atlas:ScriptReference Path="gadgetaux.js" />
</Scripts>
</atlas:Gadget>
</form>
</body>
</html>

js file

// JScript File
function handleClick()
{
LivroATLAS.AmazonHelper.GetBooks(
document.getElementById("_txtSearch").value,
1,
_onCallback);
}

function _onCallback( res )
{
var htmlContent = "";
var totalPages = res.TotalPages;
var currentPage = res.CurrentPage;

var books = res.BooksInCurrentPage;

for( var i = 0; i < books.length; i++ )
{
htmlContent += "<span><a target='_blank' href='" + books[i].Url + "'>" + books[i].Title + "</a></span><br /><span>" + books[i].Authors.join( "<br />" ) + "</span><p />";
}

if( htmlContent != "" )
{
document.getElementById("_content").innerHTML = htmlContent;
}
else
{
document.getElementById("_content").innerHTML = "No books found for that author.";
}

_fillPanel( currentPage, totalPages );
}

function _fillPanel(currentPage, totalPages)
{
document.getElementById("_panel").innerHTML = "";
for( var i = 0; i < totalPages; i++ )
{
var page = null;
if( currentPage != i + 1 )
{
page = document.createElement( "a" );
page.href = "javascript:;";
page.innerText = i + 1;
page.attachEvent( "onclick", _navigateToPage );
page.title = "Navigate to page " + (i + 1 );
}
else
{
page = document.createElement( "span" );
page.innerText = i + 1;
}
document.getElementById("_panel").appendChild( page );
}
}

function _navigateToPage()
{
LivroATLAS.AmazonHelper.GetBooks(
document.getElementById("_txtSearch").value,
event.srcElement.innerText,
_onCallback);
return false;
}

document.getElementById("_txtSearch").select();
document.getElementById("_txtSearch").focus();

asmx file

<%@. WebService Language="C#" Class="LivroATLAS.AmazonHelper" %>
using System;
using System.Web;
using System.Web.Services;
using Amazon;
using System.Configuration;

namespace LivroATLAS
{
public struct BookInfo
{
string _title;
public string Title
{
get { return _title; }
set { _title = value; }
}

string _asin;
public string Asin
{
get { return _asin; }
set { _asin = value; }
}

string[] _authors;
public string[] Authors
{
get { return _authors; }
set { _authors = value; }
}

string _url;
public string Url
{
get { return _url; }
set { _url = value; }
}

public BookInfo(string title, string asin, string[] authors, string url)
{
_title = title;
_asin = asin;
_authors = authors;
_url = url;
}
}

public struct TotalBookInfo
{
private int _currentPage;
public int CurrentPage
{
get { return _currentPage; }
set { _currentPage = value; }
}

private int _totalPages;
public int TotalPages
{
get { return _totalPages; }
set { _totalPages = value; }
}

private BookInfo[] _booksInCurrentPage;
public BookInfo[] BooksInCurrentPage
{
get { return _booksInCurrentPage; }
set { _booksInCurrentPage = value; }
}

public TotalBookInfo(int currentPage, int totalPages, BookInfo[] books)
{
_currentPage = currentPage;
_totalPages = totalPages;
_booksInCurrentPage = books;
}
}

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class AmazonHelper : System.Web.Services.WebService {

[WebMethod]
[Microsoft.Web.Services.WebOperation(true, Microsoft.Web.Services.ResponseFormatMode.Json, true)]
public TotalBookInfo GetBooks( string author, int currentPage ) {
AWSECommerceService service = new AWSECommerceService();
ItemSearchResponse resp = service.ItemSearch(this.GetItemSearch(author, currentPage) );

if (resp.Items[0].Item == null)
{
return new TotalBookInfo(1, 1, new BookInfo[0]);
}

System.Collections.Generic.List<BookInfo> books = new System.Collections.Generic.List<BookInfo>();
foreach (Amazon.Item item in resp.Items[0].Item)
{
books.Add(new BookInfo(item.ItemAttributes.Title, item.ASIN, item.ItemAttributes.Author, item.DetailPageURL));
}

TotalBookInfo info = new TotalBookInfo(currentPage, Convert.ToInt32( resp.Items[0].TotalPages ), books.ToArray());

return info;
}

private ItemSearch GetItemSearch(string author, int currentPage)
{
ItemSearchRequest request = new ItemSearchRequest();
request.Author = author;
request.Count = "5"; //just to be safe :)
request.ItemPage = currentPage.ToString();
request.SearchIndex = "Books";

ItemSearch search = new ItemSearch();
search.Request = new ItemSearchRequest[] { request };
search.SubscriptionId = ConfigurationManager.AppSettings["AmazonId"];

return search;
}

}

}


Thanks for the reply. In one of your posts above, you said you implemented remote web services call using "iframeexecutor client class" ... Thats what I am really interested in. Basically how to do cross-domain calls from the client side without using Helper-webservice.

Any help would be appreciated.

Thanks again,

~Indo.


hello.

if i recall it correctly, there's not much into it. you just need to enable the iframecall.axd handler on the server side and you'll get the call made automatically (ie, the client side proxy will detect that you're invoking a remote web service and it'll use the handler automatically).


Hello...

I don't know if this will solve your problem, but I was receiving the same JavaScript error when implementing a bridge to call a remote web service.

The solution was as simple as adding this tag inside <microsoft.web> in web.config file:

<

webServicesenableBrowserAccess="true"/>

Hope this helps

Jaime


hello Luis

I see in your example following rows:

<atlas:Gadget runat="server"

I use MS AJAX v 1.0 b2 and I can't find this tag (I try asp:Gadget )

and second question - linkhttp://atlas.asp.net/docs/Walkthroughs/DevScenarios/gadget.aspx is not correct now. I have not found correct link :(

Please, help me. Thanks


hello.

unfortunately, gadget integration has been removed from atlas and i think it won't make it when v1.0 is out.


How I can call of web-service? should I create SOAP message?

Thanks


hello again.

as i told you in my previous mail, you cannot use the gadget control since it has been removed from the ajax extensions platform. i think that now you're supposed to use the API of live.com


It is very a pity :(
Thanks again

hello.

well, you can still use AJAX extensions in your gadget, though you do need to write more code without the gadget control.

Wednesday, March 21, 2012

Need Help With The ModalPopup Control

i have a few questions about the ModalPopup control. i was wondering if somebody more experienced could help me. I only installed Atlas yesterday - Im a bit of an Atlas newbie - so i apologise in advance if any questions sound naive.

1. when my page first loads the ModalPopup control is visible for a second or so then disappears. This has been mentioned before here:http://forums.asp.net/thread/1363694.aspx. My manager will not accept this as it looks 'odd'. Is there a fix for me?

2. when my ModalPopup control pops up the dropdownlists within the <div> below it disappear. This has also been mentioned here:http://forums.asp.net/thread/1363694.aspx. I tried re-referencing the ControlToolkit dll's as this previous poster suggested but it still doesn't work for me. Am i missing something?

3. my ModalPopup control contains a user control which is in effect a search facility. this search facility needs to post back in order to populate its grid with results. when my button within the ModalPopup control causes a post back the ModalPopup control is hidden after the post back. Can I fix this?

4. Finally, is the ModalPopup control only designed for more simple situations like the paragraph selector in your examples? Am i pushing it too hard by trying to put a more complex user control inside it that itself needs to do multiple post backs? Should I be looking at other alternatives?

Thanks for any help!

Hi Wee Bubba,

Let's go through your questions:
1. If you set "display: none" in theStyle attribute of yourModalPopup, you won't see it when it loads.
2. The drop down lists are intentionally hidden - if we didn't hide them then they would appear on top of the transparent overlay and you could manipulate them. This is a problem with IE and certain controls. A lot of people on the forums have discussed working around this by using an IFrame - and I think someone might even be working on incorporating that into the Toolkit.
3. TheModalPopup won't be visible on a postback. If you want to use it with postbacks, I would recommend wrapping the contents of the popup in anUpdatePanel.
4. You should be able to get away with anything inside aModalPopup that you can inside anUpdatePanel - which means you can do an awful lot inside of it.

Thanks,
Ted

hi ted, and thanks for your comprehensive replies. it is reassuring to know that there is such a helpful community for atlas, and this is one of the reasons why i have chosen Atlas over some of its counterparts.

i will endeavour to implement your suggestions and will come back to you if i get stuck again (if thats ok).

onwards and upwards!


hello again. i have been wrestling with this ModalPopup control all day. i am tantalisingly close but i have a few more questions to hit you with if that is ok. if you would be so kind!

it is perhaps helpful for me to describe what i am trying to achieve on this web page. basically, when my users are inserting or editing a row in my datagrid they need to specify a client code. in order for them to arrive at a client code, i am offering them a search facility where they can search by name or department. then they can select the correct entry from a results grid. this search facility is what i have put inside the ModalPopup control.

1. when my ModalPopup control gets launched, is there any way i can pass a request to the user control within it? basically i want to set the focus within a particular textbox within the user control.

2. when my ModalPopup control gets launched, is there anyway i can pass a parameter to the user control within it then execute a codebehind method automatically. e.g. so if a user is on the grid and types in 'Sm' then clicks the popup button, i would like to launch the popup and automatically fill the search textbox with 'Sm' and also show them a list of results for 'Sm' as well automatically.

3. the ModalPopup control asks for an OK button. yet i will need to close it when a user clicks on any of the links within the search results grid. can this be done?

4. Finally, when a user selects a 'hit' within my popup user control, i would like to send some of this selected data back to my grid on the main page to fill the row. is this possible?

thanks again for any help. if you like i can send this sample in once im finished with a dummy xml dataset so that you can use it as an example. just let me know.


Hi Wee Bubba,

1-3. Take a look at this post:http://forums.asp.net/thread/1386346.aspx. Unfortunately it's not completely trivial to do some of the things you want - yet. We're working on making a lot of these scenarios easier in our next release (we don't have a date yet - but it should be within the next few weeks). Essentially the strategy boils down to: 1) Do whatever it is you want to do on the server (i.e. when the user clicks a button, setup whatever content you want in yourModalPopup, etc.), 2) usingRegisterStartupScript, send back some JavaScript to the client that shows the popup. It gets tricky with theUpdatePanel, but the code in that post should be safe to copy/paste where you need it for now.

4. If everything's wrapped inUpdatePanels, you can have a server event raised by a click in your modal popup update some data in the form (and then also close theModalPopup from the server in the same way you opened it on the server).

If any of that wasn't detailed enough, please ask about any other questions that you have.

Thanks,
Ted

Ted

I do have one more unrelated question that occurred to me yesterday evening. As I was having a few difficulties implementing the ModalPopup control (I appreciate it's still in beta) I got to thinking about alternative solutions. I thought about the following 2 alternatives:

- Using an old fashioned non-Atlas javascript child window to hold my search facility.

- Placing my search facility within a hidden <div> then swapping the layer's visibility when a user clicks the popup button. (i believe i can maintain the state of the layer's visibility by including a hidden field to keep track of this).

I then tried to understand how a ModalPopup control was any different to these traditional methods I have just outlined, what advantages it had etc. To be honest I couldn't work out the difference. I couldn't tell myself why I had been working so hard to use this control, other than my mind had been focused on Atlas at the time with using the UpdatePanel.

Can you give me any reasons why it is better to use this control? Otherwise I'm thinking of using one of the old-fashioned javascript routes as described above in order to save development time. Thanks again!


Hi WeeBubba,

ModalPopup doesn't really offer a lot more than either of your solutions in terms of functionality, although its user interface may be a little friendlier. Most of the "Atlas" Control Toolkit is not designed to be better than anything you could write in JavaScript by hand (look atConfirmButton, for example). The real benefit withModalPopup is that you don't have to re-code this scenario for every page you want to behave this way - and then tweak all of those when you realize your script doesn't run quite as expected on all the browsers you have to support.

You definitely shouldn't go crazy trying to rework things just to use one of our controls if you do it much easier in JavaScript though.

Thanks,
Ted


WeeBubba - you may want to look at the example code I placed on my blog at tech-review.org. I had spent nearly three weeks trying to get the modal to be a bit more form intensive. It is actually relatively simple to do what you are trying to do if you do not not mind incorporating a bit more code into your user control. While my code is not totally documented (I wrote the article at 3 am after a well documented article was lost due to to CS loosing my session and subsequently my article... ) it is doumented where needed and provides a framework for handling actual forms within a ModalPopUp...