Showing posts with label framework. Show all posts
Showing posts with label framework. Show all posts

Wednesday, March 28, 2012

Difference between $find and $get Methods in AJAX.NET Framework?

Hi All,

Can anybody help me understand the difference between $find and $get methods in AJAX.NET framework.

I was surfing through the samples of AJAX Toolkit Samples.


Hi,

$get is used to get a reference to a DOM element. It is an alias for Sys.UI.DomElement.getElementById:

<span id="myLabel"></span>

var myLabel = $get('myLabel');

$find is an alias for Sys.Application.findComponent() and it's used to get a reference to a particular component, given its id.


Hi Garbin,

In the sample application for AJAX Toolkit we have an example for Accordion. I am extracting the following code snippet from file -

 function toggleFade() { var behavior = $find('ctl00_ContentPlaceHolder1_MyAccordion_AccordionExtender'); if (behavior) { behavior.set_FadeTransitions(!behavior.get_FadeTransitions()); } } function changeAutoSize() { var behavior = $find('ctl00_ContentPlaceHolder1_MyAccordion_AccordionExtender'); var ctrl = $get('autosize'); if (behavior) { var size = 'None'; switch (ctrl.selectedIndex) { case 0 : behavior.get_element().style.height = 'auto'; size = AjaxControlToolkit.AutoSize.None; break; case 1 : behavior.get_element().style.height = '400px'; size = AjaxControlToolkit.AutoSize.Fill; break; case 2 : behavior.get_element().style.height = '400px'; size = AjaxControlToolkit.AutoSize.Limit; break; } behavior.set_AutoSize(size); } if (document.focus) { document.focus(); } }

Here I think 'ctl00_ContentPlaceHolder1_MyAccordion_AccordionExtender' is used as client Id for the MyAccorion control inside the Content Place Holder.

If I do the same without a content place holder and in different file I get a null reference.

I entered the server side Id for the $find method.


The answer is as always in C:\Program Files\Microsoft ASP.NET\ASP.NET 2.0 AJAX Extensions\v1.0.61025\ScriptLibrary\Debug\MicrosoftAjax.js and thedocs (vaguely).

$get wraps document.getByElementId ++

$find is like FindControl (I think). It seems to walk up containers to find aSys.Component


Docs on $find (findComponent)

Docs on $get (getElementById)



Great, I could get the meaning of it

Thanks a LotChristopher and Gabriel

Did Features Get Fixed In RC?

I loved ASP.NET Ajax back when it was "Atlas", but I haven't used it much since. There were a few things that really bothered me about the framework, however, and I'm wondering if things have changed.

In particular:

1. Is there a concept of an "event" in the client script library for the built-in features (like are there events like "DragStart" for the drag/drop functionality for example).
2. Does ASP.NET Ajax still require the SciptManager/ScriptManagerProxy malarky? I was hoping there would be a SciptManagerSettings control and that Atlas controls automatically registered a ScriptManager "singleton" (per page request) when they're loaded (the idea being you don't have to mess with the clumsiness of worrying about whether the ScriptManager already exists somewhere a MasterPage/Page/base class).

This post from Scott Guthrie tells you exatly the bug fixes and new improvements:

http://weblogs.asp.net/scottgu/archive/2006/10/20/ASP.NET-AJAX-Beta-1-Released.aspx

Monday, March 26, 2012

Design Time Support

Hey gang.

I am new to ASP.NET and as well ASP.NET AJAX. I am loving how this framework can turn a regular form into an AJAX form with very little work.

One thing I am struggling to understand though is why AJAX controls are much much difficult to develop/handle. One example is it seems working with ASP.NET AJAX you have a ton of those gray boxes all over your designer window because none of the AJAX controls have any designer support. Is there any way to make this possible? Once the design surface begins not having any comparison to the live look the designer becomes irrelevant in my opinion.

Thanks and take care.

Anyone? One of the greatest strengths thus far building custom controls etc is the ability to see your page in the designer etc. When using TabContainer for example from the AJAX toolkit, all the controls you put inside of the TabPanel you cannot see in the designer, so my large form I cannot see what it looks like without running. This kind of goes backwards as far as Visual Studio experience is concerned in my opinion. No purpose for smart tags etc if all my contents are not visible etc.

Am I missing something here?

Thanks and take care.


When you create a Toolkit component, a designer class is created, so all the plumbing for creating a great design time experience is there. We've chosen not to focus on this for a few reasons:

1) Many of the components in the Toolkit are Extenders. For the PopupControl extender for example, what UI do you show at runtime

2) Most of the work in AJAX components is done via JavaScript by manipulating the DOM. The designtime isn't really running in the same context so you can't easily share any of the code.

3) There is a basic property-setting experience that the Toolkit does provide you. The Extender itself has a "TargetControlID" property which tells which component it's associcated with. Then if you click on the extendee, you'll see an "Extenders" category show up in the property browser that allows you to modify and set up properties via that experience.

4) The next version of the Web Designer will have a better design experience for extenders (we're currently working with them on what that should look like) but it's still not very UI focused.

So that's kind of where our thinking is at.

Hope that helps!

Shawn


Thanks so much for the reply!

I am glad design time in the future is being considered. I just find it dissapointing that some very basic design time is missing such as again TabContainer. I throw a big form into a TabContainer it should atleast render on the designer so I can see my form. This is just my opinion though. Also I think (possibly new version of VS?) extenders shouldn't be cluttered all over the designer. Perhaps if an extender is linked to a control, if I right click on that control a list of extenders is visible, or some sort of ExtenderDesigner interface.

I understand what your saying but, going from what I am learning in ASP.NET and how rich the framework is and how great the development process is, it seems if I move to heavy AJAX pages, I lose all of that and my designer surface will be all blank because my controls are contained in TabContainer's etc.

I also understand that its hard to represent everything since a lot occurs via Javascript but I think there may be a happy medium somewhere here. I am finding my WebForm just is a bunch of extenders in the designer and I cannot see anything but extenders.

Thanks again and take care.


We hear you. You're right - things like TabContainer are a different type of control and should have better design time support. It's easier for the controls than for the extenders.

On the topic of the extenders, yes, we'll be making these a little less obtrusive on the design surface - you're absolutely right.


Wow cool. Thanks :) I am really liking the new attitude on a lot of the new projects/CTP's.

Thank you so much for listening to the community. I just want to make sure these new technologies continue to be at the level all of MS's developer tools are at. The best available in my opinion.

I am actually working on a Form Generator control. The idea is you set a bunch of inputs, and set their parameters (required, validation type, invalid/missing messages) and the generator just creates all the objects required to get the job done. I am myself having a tough time with getting full designer support.

Is there anyone I can speak to about this? I was using the Dojo framework to do all the JS but now with alot of the ASP.NET AJAX controls I think similiar could be done with some of these. In addition to this functionality the next level would be to simply pass it a DataSource or something similiar and it would auto-detect the fields, data types and auto-gen a form etc.

I would really like a bit of help though since I am struggling with some of the designer based stuff. I have been posting on the newsgroups etc but haven't been getting any helpful insight.

I think if I could get a bit of help I would then release it or contribute it if its usable.

Do you know of someone/somewhere that would be the proper place to speak about design time support?

Thanks and take care.

Saturday, March 24, 2012

Deployment of ASP.NET AJAX based application

Hey,

I want to deploy my AJAX application on a server which does not have the ASP.NET AJAX framework.Can anybody tell me what the requirements on the server are for the application deployment apart from Microsoft.Web.Extensions.dll in GAC?

Thanks

I would like to have further information about the same issue.

For sure you must have the .dll either in GAC or /bin of the deployed Atlas website, but I think it's required to update the web.config (obviously server-side) but unfortunately I don't know exactly how.

There is a lot of confusion about this issue all around... Help!

Thanks

Deploying Atlas Web Site

Is it as simple as running the Atlas install? Is there a way to identify the files and include the files within our existing framework? Have Googled this and found very little in regards to deploying to a production server a Atlas enabled web site.

Thanks

PinkFloyd43 - From The Dark Side Of The Moon

Deploying an Ajax (formerly known as Atlas) website is as easy as sleeping in your bed.

The only file that you need from Ajax is the AjaxControlToolkit.dll, which you put it in your bin folder if you use it. All the other files are in the GAC of the server.

The server has to have Ajax installed. Hope that helps.


Hi. I have a similar question. I understand the need to install Ajax on the GAC and this simply means running the installer package form the Ajax site or Code plex on a production environment.

Here are some questions I have.

1. Is there any way that Ajax would NOT work if everything is installed using a Xcopy in my bin folder of the Ajax enabled web site?

2. What about security and trust levels? What is the impact of this from a deployment standpoint?

3. I assume I would not be able to install Ajax on the GAC if I have a hosted server where I host my application? What are the recommendations in this kind of a scenario?

Thanks in advance,
Sriram


I have the same doubt. Please help me out