F9 Group Marketing and Technology Blog

Marketing, Technology, and current news at http://www.f9group.com/

Entries Tagged ‘appearance’

Using Microsoft’s Chart Controls In An ASP.NET Application: Serializing Chart Data

In most usage scenarios, the data displayed in a Microsoft Chart control comes from some dynamic source, such as from a database query. The appearance of the chart can be modified dynamically, as well; past installments in this article series showed how to programmatically customize the axes, labels, and other appearance-related settings. However, it is possible to statically define the chart’s data and appearance strictly through the control’s declarative markup. One of the demos examined in the Getting Started article rendered a column chart with seven columns whose labels and values were defined statically in the <asp:Series> tag’s <Points> collection. Given this functionality, it should come as no surprise that the Microsoft Chart Controls also support serialization . Serialization is the process of persisting the state of a control or an object to some other medium, such as to disk. Deserialization is the inverse process, and involves taking the persisted data and recreating the control or object. With just a few lines of code you can persist the appearance settings, the data, or both to a file on disk or to any stream. Likewise, it takes just a few lines of codes to reconstitute a chart from the persisted information.

Share and Enjoy:
  • Digg
  • Google
  • del.icio.us
  • Technorati
  • Facebook
  • MySpace
  • TwitThis
  • Blogsvine
  • description
  • E-mail this story to a friend!
  • Ping.fm
  • Print this article!
  • Slashdot
  • Yahoo! Buzz

Updates to the TextBox Word / Character Counter Control

When storing user-supplied text data into a database, it is essential that the length of the user’s input does not exceed the size of the corresponding database table field. To ensure that a user’s input is within the legal bounds, you can: set the TextBox control’s MaxLength property (although this does not work for multi-line textboxes); use a validation control, such as my TextBoxLengthValidator control or a RegularExpressionValidator; use server-side code to check the Length property of the string before storing it in the database; or some combination of the above. The problem with these solutions is that they are not very interactive. The user doesn’t know how close she is to hitting the maximum number of characters. In October 2007 I created a custom ASP.NET server control that uses JavaScript to interactively display the number of characters and/or words a user has typed into a textbox, and wrote about it in an article titled Creating a TextBox Word / Character Counter Control . In the TextBoxCounter control’s initial implementation is simply reported how many words or characters the user had entered. Because this control is most useful in scenarios where there is a limit to the number of characters or words allowed, a natural enhancement would be to allow the page developer to specify a maximum number of characters or words allowed. With this information, the control could be updated to show how many characters or words remain.

Share and Enjoy:
  • Digg
  • Google
  • del.icio.us
  • Technorati
  • Facebook
  • MySpace
  • TwitThis
  • Blogsvine
  • description
  • E-mail this story to a friend!
  • Ping.fm
  • Print this article!
  • Slashdot
  • Yahoo! Buzz