Showing posts with label toolkit. Show all posts
Showing posts with label toolkit. Show all posts

Wednesday, March 28, 2012

Why Popup Calendar doest trigger textbox event OnTextChanged?

A textbox connect to an Atlas Toolkit Control PopupCanendar.
There is a javascript for OnTextChanged event of this textbox.

When using popup calendar to select a date for this textbox, it doesn't trigger this event.
But if type date in textbox directly, it is OK. the OnTextChanged will be fired.

Why? what's the solution for this case?The DOM is a little weird in that script changes don't tend to fire the associated event handlers that get fired when the user makes a change. It sounds like you're hitting that here. It's possible to fire the event from script, too, so maybe you want to try that. If you switch to PopupControl's CommitScript mode, I think you should be able to make this change fairly easily.

Why The Toolkit DLL is much bigger than download

I download the Version 1.0.10301.0 Ajax Control Toolkit. Both of With Source code and without .I found a question.The ajax control toolkit dll file which is in the without source code package is 764KB(in "\SampleWebSite\Bin" ),but the dll file I generated from the source code is near 1.3MB. Why?

if you compiled in Debug mode, then your assembly would be larger than if you had compiled in Release mode.


oh~~~~~~~~ Right! Thanks for your help answer!

Monday, March 26, 2012

Will new controls run in VB project

I notice that the November Control Toolkit controls are written in c#.
Can they be added to a VB project?
Thanks in advance.
Glenn Michael

Found the answer in the FAQ for the forum. Please excuse the post...

window.onerror and Toolkit

I am implementing logging of client-side errors to ASP.NET Health Monitoring using a technique similar to this one:

http://www.newtonsoft.com/blog/archive/2006/05/02/Logging-JavaScript-Errors-To-ASP.NET.aspx

This code adds a client-side handler to window.onerror, and posts via xmlHttp to an HttpHandler that logs the exception via Health Monitoring. To test, I have a page with a simple javascript error (<a href="http://links.10026.com/?link=http://forums.asp.net/AddPost.aspx?ForumID=1022#" onclick="throw 'test exception';">Throw error</a>) AND a Ajax Control Toolkit Calendar extender with OnClientHide set to throw a test exception.

This works in both FireFox and IE for the most part, but there are a few issues I'm having trouble getting to the bottom of:

-In IE the message is "Exception Thrown and Not caught". I would prefer to get the actual message. In FF, the message is "uncaught exception: test exception", which is more useful IMO. How can I
get the actual message in IE javascript?

-In FireFox, the "simple" example above works, but in the "Ajax Control Toolkit Calendar" example, the error is displayed in the FF error dialog, but not caught by window.onerror. It acts as if there is something intercepting the error and not causing it to fire "onerror". I've looked in the source and docs, but can't find where that would be. Any ideas how to get this working with MS Ajax + toolkit?


Have you considered using the MS AJAXsupport for exceptions. Instead of throw 'test exception' you could have Error.create('testException') and in the handler get the message.

Regarding the window.onerror event not getting fired in the Calendar case, could you post a small example that we could try out?


Thanks for the reply and link... 'throw Error.create(...);' does help address the first issue, where IE wasn't returning the actual error message. I'll have to see about the best way to implement this, since it may be used in some cases on pages that do not use MS Ajax, in which case Error.create() wouldn't exist. Also, though, I don't always have control over the error that is thrown. For example, if there were an error in a 3rd party control's javascript, then it may not use this pattern to throw exceptions...

I'm still finding the behavior different between IE and FF inside a CalendarExtender. Below is an example. You'll need to copy into a project that references MS Ajax & Ajax Control Toolkit and modify the @.Page tag to get it to work.

In this case I'm just handling all errors and showing a messagebox. (In the real code, I post it via xmlHttp to an HttpHandler...). In FireFox, the behavior is that the "Simple Example" works as expected, while the "Ajax Example" does not result in a call to window.onerror. The weird thing is that FireFox does in fact register an exception in the Error Console (Ctrl-Shift J), but somehow it skips window.onerror.

Thanks again for your help!

<%@. Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="ClientLoggingSpike._Default" %><%@. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Untitled Page</title> <script type="text/javascript"> window.onerror = function(message, url, line) {alert(message + ":" + url + ":" + line);}; function throwTestException() { throw Error.create('Test Exception'); } </script></head><body> <form id="form1" runat="server"> <div> <asp:ScriptManager ID="ScriptManager1" runat="server" /> Simple Example<br /> <a href="#" onclick="throwTestException();">Throw Exception</a><br /><br /> Ajax Example<br /> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <asp:Button ID="Button1" runat="server" Text="Calendar" /> <cc1:CalendarExtender ID="CalendarExtender1" runat="server" PopupButtonID="Button1" TargetControlID="TextBox1" OnClientHidden="throwTestException"> </cc1:CalendarExtender> </div> </form></body></html>

I see the issue however I am not sure why FF is causing that. TheASP.NET AJAX team may know more about this since they work encapsulating these browser eccentricities. You might get an answer on their forum.
Thanks for your help. I've posted over there and will see what they say.

Wishtlist? Yahoo UI Ext like Toolkits

Hey all,

I'm just saying.. and it's my personal opinion. In most cases, I don't find most of the Ajax control toolkit useful in my every day apps. The only ones I see that are really useful to me are ModalPopup, Accordion, mabye Calednar, but other than that, it doesn't contribute much to the end user experiences. I feel like it's a bunch of random old javascript library got wrapped in .net controls. (No pun intended) What we have is cool, just not so useful (again just my perosnal feeling)

I wish Ajax Control Tool Kit could actually serve some real stuff, real GUI componets like Grids, Dialogs boxes, Tabs, u know, the stuff you see in windows. Take a look at the Yahoo GUI Ext Grid (resize, drag/drop column, edit in place)
http://www.yui-ext.com/deploy/ext-1.0-alpha3/examples/grid/edit-grid.html

Tabs
http://www.yui-ext.com/deploy/ext-1.0-alpha3/examples/tabs/tabs-adv.html

Menu
http://www.yui-ext.com/deploy/ext-1.0-alpha3/examples/menu/menus.html ( okay, we can wrap out menu control inside the updatepanel, this just serves as an example)

Even a FeedViewer using a composite of others

http://www.yui-ext.com/deploy/yui-ext/examples/layout/feed-viewer.html

These are the Gui componets that actually helps our user experiences and are commonly used. I guess I'm just trying to say if we can focus a bit more on the real stuff, it will be SO MUCH more useful to the MS Ajax suite. I hate the fact others are beating us to it and I have to use MS ajax on the backend while using others on the front end.

Hmmm...interesting post!

I don't totally agree with what you are saying as I think a lot of the stuff in the toolkit at the moment provides a good foundation of AJAX controls (although admittedly there are some that I will never use). However, it would be nice to see some richer controls like the Feed Viewer example that you provided which really give the toolkit the wow factor..."the wow is now" or something like that ;-)

The toolkit already has Tabs and you can do Menus as you say. A rich AJAX grid control should be right up there though I reckon. There is acontrol wishlist that shows what is on the radar at the moment for the dev team and you can always make suggestions in CodePlex and drum up some votes to get priority.

I think it is a case of playing catch-up with the other AJAX stuff out there but the advantage of the MS toolkit is that it is so nicely integrated with the ASP.NET framework and with great serverside support for the controls too. I'm really encouraged by this project but it maybe just needs a bit more resourcing to shift it up a gear??


Thanks for your feedback Liming.

If you take a look at the latest version of the toolkit we have added a newTabs control. Thedropdown extender may serve your menu requirement. We have anajax grid item very highly demanded on our issue tracker. The feedviewer is a great idea. We just discussed this today with one of our contributors, Jim Zimmerman, who is here for the MVP summit. You can alwayscreate a new work item for it and we will let the community decide.

Please let us know if you have more detailed comments and we can discuss possible solutions to help make the toolkit more useful for you.

Kirti


Hey guys,

Thanks for your reply. I was just trying to compare the toolkit with others, and it was the "wow is now" moment. Didn't know there was this wiki of feature requests before, lots of good stuff there and it made me feel really comfortable to know what might be coming back :)

Thanks again.Smile

Saturday, March 24, 2012

Work with 1 control

I like the tab control in the toolkit. I would like to use the source code and remove the other controls and adopt the tab control into our code base.

What are the dependencies for this control?

Thanks...

You should keep the code in the Common, ExtenderBase and ScriptResources folders along with everything in theTab folder in the AjaxControlToolkit project and give it a shot. You can always add code incrementally if you discover more dependencies (exclude the rest and see if the tabs demo works).
What's wrong with referencing the entire toolkit and just using the tab control?
I would agree. That is a better approach and would help avoid treading down unsupported paths. The ship dll is very small in size around 750KB.

Working with Ajax Toolkit Controls from JavaScript

I can't seem to find any documentation on using Ajax toolkit controls from java script. I want to know how to obtain a ref to one like other controls ex. (var ctrl = document.forms[0].TextBox1); also is it possible to set properties and call methods form Java Script?

Hi,

The key to manipulate extender via javascript it to find the corresponding behavior object, and invoke methods on it.

First, you need to specify a BehaviorID for the extender. For instance:

<ajaxToolkit:CollapsiblePanelExtender ID="CollapsiblePanelExtender2"
BehaviorID="cpe2Behavior"
runat="server"
TargetControlID="panel3"
ExpandControlID="panel4"
CollapseControlID="Panel4"
Collapsed="True"
TextLabelID="lnk2"
CollapsedText="Show Details.."
ExpandedText="Hide Details.."
>
</ajaxToolkit:CollapsiblePanelExtender>

Then, use $find method to get it and invoke methods.

var cpe2Behavior =$find("cpe2Behavior");
cpe2Behavior.add_expandComplete(expandedHandler);

Currently, I'm not aware of any formal documentation about what methods or properties are available to each extender, but you can find them in the source code of it.

Hope this helps.


I tried that but theAccordion control dosn't seem to have a BehaviorID property


Accordion doesn't have this property. You can use its clientID instead.

Works locally but not on hosting server

I have installed V 1.0 and the toolkit, modified my webconfig file and have everything working great locally but am unable to use it on my we hosting server at web.com, I can only assume that they do not support it at this time.

The ajax assemblies need to be installed in the GAC on the hosting server.

You would need to confirm that this has been done with your host.


I have the same problem. Presumably to install the assemblies in the GAC is done by installing the ajax extensions.

Wednesday, March 21, 2012

Writing Games in ASP.NET AJAX

Hi All,

I was curious about usingAnimation behaviors in the toolkit to create games, but I found that they came up a bit short for this kind of task. So I wrote some behaviors and control extenders to allow sprite animation, collision detection, and some other fun stuff.

If you're interested in trying out this first version please check out thisblog post andproject page.

AndyBeaulieu:

Hi All,

I was curious about usingAnimation behaviors in the toolkit to create games, but I found that they came up a bit short for this kind of task. So I wrote some behaviors and control extenders to allow sprite animation, collision detection, and some other fun stuff.

If you're interested in trying out this first version please check out thisblog post andproject page.

That is so COOL! I am so trying this out... wonder if my bosses would let me put a shoot the fish game in our Government Applications.. you know... incase the customers get bored... could always bring back the amazing "Boss Key" :D

Writing New Control - WebResource Url Throwing Exception

Hey Everyone,

I'm having a really hard time with this one. I recently upgraded to lateest control toolkit, and now i can't use my custom controls. I get the dreaded unrecognized tag error.

When I try to load the webresource.axd url for the javascript, I'm getting the following error:

WebResource.axd?d=_IYF6c389WdEZP8BREten0VCyRTYFXUFn9GR9MRXP-aoOJ5cYUZwsxAz4rdBOPaz6CoHQyUbH48-Kn0gv5WhhCj2yI8nUNAt-hz-wRrJAwI76fBROssmxDJplsNW85vw0&t=632907313964152042

Specified argument was out of the range of valid values.
Parameter name: offset

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: offset

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:

[ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: offset]
System.Web.HttpResponseStream.Write(Byte[] buffer, Int32 offset, Int32 count) +3153595
Microsoft.Web.Services.WebResourceCompressionModule.OnPreRequestHandlerExecute(Object sender, EventArgs e) +1103
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64


any ideas?For some reason, the Atlas Control Extender template doesn't make the Behavior.js an embedded resource. Change that in the properties pane and rebuild.
yeah, i saw that in the FAQ, and made sure (and double sure) that it was marked as an embedded resource. and it looks like it is, because i am seeing the resource in the source. it's when the browser tries to read the resource that .NET is throwing that funky WebResourceCompressionModule error...
So using a tool like Fiddler, the js file is being sent across?? Hmmm.
I actually saw this yesterday when I was doing some work but (unfortunately) I didn't ever figure it out, mostly because it kind of magically went a way. I think I rebuilt everything clean and it started working.

WYSIWYG-editor saying that a ScriptManager is not present when it is; throws an exception

Hey Guys,

I'm new to the AJAX Toolkit, so pardon me if my problem seems a bit dumb.

WYSIWYG Exception

As you can see in this image, I have a ScriptManager on the page, so I don't have a hot clue of what's really causing the problem. My HTML is all valid, and I can actually run the page through the built-in server and it works just fine.

Anyone have any ideas?

I'm not so sure but I think this could be caused by a wrong reference to the library that ajax uses (the Web.Extentions).

Try to remove the scriptmanager and just drag a new ScriptManager from the ToolBox to the top of the webpage. Then save the page, close it, and reopen it. Normally the design-view should render normally now.

I hope this helps!

Greets,
Wim

XLST and control toolkit

I have been learning about using an XML file and an XLST file to create a user editable form however I have yet to find a successful working version of this including a toolkit procedure

Can it be done? If so has anyone actually done it and showed how? If not why not?

A not correctly formatted example of what I want to do:

<XML File>

<Input Name="NumbersOnly" FilteredTextBox="Yes" Type="NumbersWithNeg"/>

</XML>

gets me the output of this:

<

asp:TextBoxID="TextBox3"runat="server"></asp:TextBox>

<

ajaxToolkit:FilteredTextBoxExtenderID="ftbe"runat="server"TargetControlID="TextBox3"FilterType="Custom, Numbers"ValidChars="-"/>

It can be done. Heres how

<Code on main page>

private

void CreateSurvey() {// Load the data sourceXPathDocument surveyDoc =newXPathDocument(Server.MapPath("ExSurvey.xml"));// Load the xslt to do the transformationsXslTransform transform =newXslTransform();

transform.Load(Server.MapPath(

"MakeControls.xslt"));// Get the transformed resultStringWriter sw =newStringWriter();

transform.Transform(surveyDoc,

null, sw);string result = sw.ToString();// remove the namespace attribute

result = result.Replace(

"xmlns:asp=\"remove\"","");

result = result.Replace(

"xmlns:cc1=\"remove\"","");

result =

"<%@. Register Assembly=\"AjaxControlToolkit\" Namespace=\"AjaxControlToolkit\" TagPrefix=\"cc1\" %>" + result;int i;// parse the control(s) and add it to the pageControl ctrl = Page.ParseControl(result);

survey.Controls.Add(ctrl);

}

<XLST File>

<

xsl:stylesheetversion="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"xmlns:asp="remove"xmlns:cc1="remove">

<

xsl:outputmethod="xml"indent="yes"encoding="utf-8"omit-xml-declaration="yes"/>

<

xsl:templatematch="/">

<

table>

<

xsl:for-eachselect="//question">

<

tr>

<

tdvalign="top"><xsl:value-ofselect="@.name" />

<

xsl:iftest="@.required = 'yes'">

<

asp:RequiredFieldValidatorErrorMessage=" Required Field"runat="server"ControlToValidate="{@.name}" />

</

xsl:if>

</

td>

<

td>

<

xsl:iftest="@.type='text'">

<

asp:TextBoxid="{@.name}"runat="server" />

<

cc1:FilteredTextBoxExtenderID="FilteredTextBoxExtender{@.name}"runat="server"TargetControlID="{@.name}"FilterType="Numbers">

</

cc1:FilteredTextBoxExtender>

</

xsl:if>

<

xsl:iftest="@.type='radio'">

<

asp:RadioButtonListid="{@.name}"runat="server">

<

xsl:for-eachselect="choice">

<

asp:ListItemValue="{@.value}"><xsl:value-ofselect="@.value" /></asp:ListItem>

</

xsl:for-each>

</

asp:RadioButtonList>

</

xsl:if>

</

td></tr>

</

xsl:for-each>

</

table>

<

asp:buttonid="submit"runat="server"Text="Submit" />

</

xsl:template>

</

xsl:stylesheet>