Skip to main content

Posts

Showing posts from 2008

Charts: let Google work for you

I can't class myself as an developer who is always hip to the latest news in the software industry, partly through laziness and partly through necessity to write code, and not merely to surf the Internet :) That is why I missed appearance of a very cute and handy service from Google , which allowed to integrate charts into the web pages. For the time being it is only half a year old as far as I can judge by the date of the first record in the discussion group, therefore I think this information can be interesting for someone else besides me. The service allows to dynamically generate practically all essential types of charts such as bar charts, pie charts and so on. The only thing you have to do to get the chart is forming the url in concordance with some rules and the service will return the PNG-format image. As an example I decide to use data from another Google service, namely Google Analytics, which together with all its merits has one lack: the absence of public access to the

How to use standard FileUpload in AJAX-enabled web applications

I would like to note that this article is not about the ability to upload files to the server without the postback. There are a lot of articles on this topic, just type "AJAX FileUpload" on any search engine and you'll get many examples. However with AJAX they actually have little in common, because the XMLHttpRequest does not support asynchronous uploading of files to the server, they are rather a variety of imitations, for example, using hidden IFRAME element. Nevertheless I want to emphasize that the article is not about that but about the standard FileUpload control. There are two problems you might encounter when using it on UpdatePanel. Problem 1 If the postback is caused by the control which lies on UpdatePanel, FileUpload is always empty when it has come to the server, regardless whether a file has been selected or not. Example: <asp:UpdatePanel ID="UpdatePanel1" runat=server> <ContentTemplate> <asp:FileUpload ID="FileUpload1&q

Simultaneous Selection of Checkboxes in a GridView's column

If you are using checkboxes in GridView in order to select a few rows, then, no doubt, you have been faced with the task how to select/deselect all checkboxes in a selected column at a time. Usually it is solved by addition of special buttons somewhere or addition a checkbox in the GridView's column header. I want to dwell on the second variant. In order to refrain from repetition of code all of required functionality can be hidden inside of a special control. This control is inherited from the CheckBox and have only one method overriden (OnLoad). Inside the method a script is registered, this script allows to select/deselect all checkboxes in a GridView's column if a checkbox in the GridView's header is clicked. Besides, the script tracks situation when all checkboxes in rows are selected one by one and selects the checkbox in the column's header. public class GridViewCheckBox : CheckBox { protected override void OnLoad(EventArgs e) { GridViewRow parentRow = th