Dave Ward's BlogDave Ward's BlogASP.NET, C#, and AJAX.code, ideas, and examples. Articles
Highslide JS .NET Release
2007-03-27 04:13:00 My initial .NET server control version of Torstein Honsi's High slide JS .NET is now available. You can find it and information on implementing it at the Highslide JS .NET page here on my site. For a quick video introduction of what the Highslide JS library is capable of, take a look at this basic demonstration: Remember, Torstein graciously allows completely free use of his library on non-commercial sites, but if you use it in a production environment he asks a very reasonable licensing fee per domain. Please support his efforts if you do use it on a live site. More About: Release , Slide , Lease , Ease
Image Zooming Control Preview
2007-03-22 13:00:00 I've been working on and off for some time to encapsulate Torstein Honsi's excellent Highslide JS library into a .NET control. Finally, pending naming, it is ready for use. It should be available for download in the next couple days. Until then, here is a preview of it in action: The best part is that it's extremely easy to use. This is the entirety of the code used to create the demo page above: ASP: <encosia:HighslideManager runat="server" OutlineType="RoundedWhite" GraphicsPath="highslide/" /> <encosia:HighslideImage "HighslideImage 1" runat="server" ImageUrl="Thumbnail-1.jpg" FullImageURL="Image-1.jpg" /> <encosia:HighslideImage"HighslideImage 2" runat="server" ImageUrl="Thumbnail-2.jpg" FullImageURL="Image-2.jpg" /> More About: Preview , Review , Zoom , View
Postback Ritalin Update (v0.2)
2007-03-17 05:11:00 Based on my experience using it in the wild and some great feedback from those of you that downloaded it, I’ve made a few updates to Post back Ritalin . Get it and enjoy. If you haven’t seen Postback Ritalin yet, it’s an AJAX Toolkit control extender to automatically disable an Update Panel’s submitting control during partial postbacks and then re-enable them after the partial postback completes. More details are available on the permanent Postback Ritalin page. Changes in this version Added WaitImageURL, to better support ImageButton controls that raise postbacks. Added a check to ensure that the control raising the postback is either an ImageButton or Button type, to clear up some issues with submitting a form with enter while a Textbox is focused. Added a check to make sure the control that raised the postback still exists after the postback completes, in case the newly updated div no longer contains that element (e.g. a form that transitions to a confirma... More About: Back
Debug and explore AJAX with FireBug
2007-03-06 14:41:00 “where did you find documentation on the sender and event args objects in the PageRequestManager events?” Lately, if I don’t hear that question at least a dozen times a week, I start worrying that something’s wrong with my contact form. I can understand why it would be a common question. The documentation we currently have for the JavaScript portion of the AJAX framework is on the light side. The answer to the question is that I didn’t, but I can show you how I found what I did. By using a JavaScript debugger, it becomes trivially easy to explore these objects and find out what makes them tick, even without formal documentation. Personally, I use Fire Bug for JavaScript debugging, so that’s what I’ll use to demonstrate. Any JavaScript debugger that allows you to set breakpoints will work though. The code that I’m going to use for this example is my CSS style as AJAX progress indicator tutorial. With FireBug open (F12), I load up th... More About: Ajax , Explore , Debug
AJAX, file downloads, and IFRAMEs
2007-02-23 18:08:00 "Click here to download this report in Excel (CSV) format." We've probably all implemented this functionality in ASP.NET applications at least several times. Any time you're dealing with report data, it's expected that the data be available for download. Unfortunately, AJAX makes this somewhat difficult. Since there is no traditional HTTP response, you have no context with which to send the file to the browser for normal download. Enter inline frames (IFRAME). Probably one of the most under utilized HTML elements around, dynamically creating an IFRAME allows you to round trip an HTTP request and response without disrupting the AJAX-ness of your async postback. Since any browser that supports XmlHttpRequest supports IFRAMEs, it is as safe to use as AJAX is in the first place. This is a simple example of the technique, using a static list of files in a dropdown, but it could be adapted to more dynamic file creation scenarios easily. This is the example download page. The Jav... More About: Downloads , Download , File , Ajax , Down
Control to prevent multiple AJAX submits
2007-02-13 07:56:12 “To avoid duplicate credit card charges, only click the checkout button once!” I’m always surprised at how many sites display a similar warning message on their final checkout page. Major sites. Between server side detection of multiple submissions and using OnClick to disable the submit button, there is no excuse for crossing your fingers ... More About: Event , Multi , Ajax , Control , Submit
Control to prevent multiple AJAX submits
2007-02-13 04:33:00 "To avoid duplicate credit card charges, only click the checkout button once!" I'm always surprised at how many sites display a similar warning message on their final checkout page. Major sites. Between server side detection of multiple submissions and using OnClick to disable the submit button, there is no excuse for crossing your fingers and hoping your users don't double click a submit button. AJAX complicates the client side component of this equation. You can't simply disable a button in the OnClick event, because the button will remain disabled in the case of a failed form validation or other exception. The optimal behavior is for the submit button to only be disabled during the async postback, and be re-enabled when the server side processing is completed. Using the AJAXToolKit, I've created a control extender to implement this functionality quickly and easily: Postback Ritalin. Usage example ASP: <asp:UpdatePanel"up1" runat="server"> <ContentT... More About: Event , Multi , Ajax , Control , Submit
Automatic Sequential Postbacks
2007-02-02 19:51:08 I ran into a situation recently where I needed to select a set of data, present it to the user, and then give them the option to process each item individually or all items automatically. Problem was, the item processing task was long running, which complicated the ?process all items? scenario. Looping ... More About: Post , Auto , Automatic , Back , Sequential
Automatic Sequential Postbacks
2007-02-02 10:15:00 I ran into a situation recently where I needed to select a set of data, present it to the user, and then give them the option to process each item individually or all items automatically. Problem was, the item processing task was long running, which complicated the “process all items” scenario. Looping through each item and processing it all on the server side would’ve been easy enough to accomplish, but the chances of the user sitting through the 7 minute postback for 20 items was next to nil. What I really needed was incremental progress feedback, so the user could see an update as each item was processed. Luckily, I did have control over my user’s browser version and settings, so client scripting was available. With that in mind, this is the solution I came up with: Display the Items and Interface This sets up some test data, a repeater to display it, and the button controls to initiate processing. Note the runat and ID attributes of the body tag. This is important... More About: Post , Auto , Automatic , Back , Sequential
ASP.NET AJAX v1.0 Released
2007-01-25 07:41:01 http://ajax.asp.net/ This will be huge. This is also the first officially supported Microsoft release that includes full source code. More About: Released , Ajax , Release , Lease , Ease
Mouse pointer as AJAX progress indicator
2007-01-23 19:39:01 The ASP.NET AJAX UpdatePanel control provides us a quick and easy way to AJAX enable websites without changing our familiar design patterns. It's certainly much better than using full postbacks in many situations. However, it lacks usability. While the user waits on the async postback to occur, they are left without any of the ... More About: Cat , Inter , Prog , Ajax , Mouse
SWF to XAML (WPF) Converter
2007-01-23 19:39:01 I've been having lots of fun with WPF/E, and this thing has been a great help in getting me jumpstarted: http://www.mikeswanson.com/swf2xaml/ Hopefully others will find it useful as well. More About: Converter , Convert , Vert
CSS style as AJAX progress indicator
2007-01-23 19:39:01 I noticed that a lot of people found my mouse pointer as AJAX progress indicator example by using search terms suggesting they were looking for a more graphical indicator. So, here's an example of doing something more... Web 2.0. Like last time, I'll base it on a standard UpdatePanel demo using a button control ... More About: Cat , Style , Prog , Ajax , Progress
Databinding Class Data
2007-01-23 19:39:01 It took me a few minutes to figure this out and Google was surprisingly unhelpful so hopefully this will be useful to others. When databinding objects, only properties are available. To my dismay, simply making class fields public isn't enough. Even though the field is right there, publicly accessible, the databinder acts as if it's not. Consider ... More About: Data , Class , Bindi
ASP.NET AJAX v1.0 Released
2007-01-23 17:04:00 http://ajax.asp.net/ This will be huge. This is also the first officially supported Microsoft release that includes full source code. More About: Released , Ajax , Release , Lease , Ease
CSS style as AJAX progress indicator
2007-01-16 23:59:00 I noticed that a lot of people found my mouse pointer as AJAX progress indicator example by using search terms suggesting they were looking for a more graphical indicator. So, here's an example of doing something more... Web 2.0. Like last time, I'll base it on a standard UpdatePanel demo using a button control to set a time/date label, with an artificial delay: ASP: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="UpdatePanelAnimation" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-t ransitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Update Panel with Animation</title> <link href=http://encosia.com/index.php/feed/"U pdatePanelAnimation.css" rel="stylesheet" type="text/css" /> </head> <body> <form"form1" runat="server"> <asp:ScriptMa... More About: Cat , Style , Prog , Ajax , Progress
SWF to XAML (WPF) Converter
2007-01-12 12:35:00 I've been having lots of fun with WPF/E, and this thing has been a great help in getting me jumpstarted: http://www.mikeswanson.com/swf2xaml/ Hopefully others will find it useful as well. More About: Converter , Convert , Vert
Mouse pointer as AJAX progress indicator
2007-01-01 19:43:00 Update: If you're looking for something more graphical, also see my example of using a CSS style as AJAX progress indicator. The ASP.NET AJAX UpdatePanel control provides us a quick and easy way to AJAX enable websites without changing our familiar design patterns. It's certainly much better than using full postbacks in many situations. However, it lacks usability. While the user waits on the async postback to occur, they are left without any of the usual indicators. We've spent decades training our users to wait when they see an hourglass icon. Why throw all that away for a spinning Web 2.0 progress indicator that means little to an average user? Luckily, the ASP.NET AJAX framework provides us with tools to correct this shortcoming. We'll start with a run of the mill UpdatePanel setup: ASP: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <html> <body> <div"Container"> ... More About: Cat , Inter , Prog , Ajax , Mouse
Databinding Class Data
More articles from this author:2006-12-21 12:04:00 It took me a few minutes to figure this out and Google was surprisingly unhelpful so hopefully this will be useful to others. When databinding objects, only properties are available. To my dismay, simply making class fields public isn't enough. Even though the field is right there, publicly accessible, the databinder acts as if it's not. Consider a class, Payment: C#: public class Payment { public decimal Amount; Payment() { } } We might use this like so: ASP: <asp:gridview runat="server""dgPayments"> <Columns> <asp:TemplateColumn HeaderText="Amount"> <ItemTemplate> <%# Data Binder.Eval(Container.DataItem, "Amount") %> </ItemTemplate> </asp:TemplateColumn> </Columns> </asp:gridview> C#: protected void Page_Load(object sender, Sys... More About: Class , Bindi 1, 2, 3 |



