F9 Group Marketing and Technology Blog

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

Entries Tagged ‘generated’

Take Control Of Web Control ClientID Values in ASP.NET 4.0

Each server-side Web control in an ASP.NET Web Forms application has an ID property that identifies the Web control and is name by which the Web control is accessed in the code-behind class. When rendered into HTML, the Web control turns its server-side ID value into a client-side id attribute. Ideally, there would be a one-to-one correspondence between the value of the server-side ID property and the generated client-side id , but in reality things aren’t so simple. By default, the rendered client-side id is formed by taking the Web control’s ID property and prefixed it with the ID properties of its naming containers . In short, a Web control with an ID of txtName can get rendered into an HTML element with a client-side id like ctl00_MainContent_txtName . This default translation from the server-side ID property value to the rendered client-side id attribute can introduce challenges when trying to access an HTML element via JavaScript, which is typically done by id , as the page developer building the web page and writing the JavaScript does not know what the id value of the rendered Web control will be at design time. (The client-side id value can be determined at runtime via the Web control’s ClientID property .) ASP.NET 4.0 affords page developers much greater flexibility in how Web controls render their ID property into a client-side id . This article starts with an explanation as to why and how ASP.NET translates the server-side ID value into the client-side id value and then shows how to take control of this process using ASP.NET 4.0. Read on to learn more! Read More >

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

Using Microsoft’s Chart Controls In An ASP.NET Application: Programmatically Generating Chart Images

The Microsoft Chart controls demos we have examined so far all use the Chart Web control to position the chart image on the web page and to configure a number of its stylistic settings. For example, while the Plotting Chart Data article showed several demos illustrating the different ways to specify the points to plot on the chart surface, all of these demos used a Chart Web control to indicate where on the page the chart should appear, along with its dimensions, its series, its chart areas, its colors, and so on. While the Chart Web control makes it easy to get started with the chart, it is not necessary. From the ASP.NET page’s code-behind class you can: programmatically create a Chart object; specify its width, height, colors, and other display-related properties; plot the charts data points through any of the mechanisms discussed in Plotting Chart Data ; and generate an image for the chart in a number of different image formats, saving the image data to a file or to a stream. Being able to programmatically configure the chart and generate the chart image is useful if you want to modify the chart image in some way before displaying it. Perhaps you want to add a watermark, or embed it inside a PDF file . Maybe you don’t want to display it at all, but instead want to send it as an attachment in an email, or save the image to the web server’s file system or to the database. Whatever the scenario, the good news is that the Microsoft Chart controls make it easy to programmatically create, customize, and generate the chart image. This article looks at how to programmatically create a chart. Specifically, we’ll see how to dynamically add a watermark to the generated chart image, as well as how to email the chart to a recipient. The demos in this installment do not use the Chart Web control at all; instead, the charts in these demos are created and rendered directly from the ASP.NET pages’ code-behind classes. Read on to learn more! Read More >

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

Image Transforms with the ASP.NET Generated Image Control

Last week’s article – Dynamically Generating and Caching Images in ASP.NET with the GeneratedImage Control – looked at how to programmatically create and cache images on the fly using the GeneratedImage control, one of a suite of “Futures” technologies found in the ASP.NET Team’s CodePlex site . Programmatically creating and displaying images entails the use of an HTTP Handler for generating the binary content of the dynamically-generated image. While this HTTP Handler can be implemented as an ASP.NET page, the GeneratedImage control includes the ImageHandler class, which serves as a base class for HTTP Handlers designed specifically to generate and serve dynamic images and includes built-in functionality for caching images on the client and/or web server. Last week’s article illustrated both how to create an HTTP Handler for generating dynamic images (one that extended ImageHandler ) as well as how to use the GeneratedImage Web control to display such dynamically-generated images in a web page. In addition to its image generation and caching features, the ImageHandler class includes functionality for performing image transforms

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

Dynamically Generating and Caching Images in ASP.NET with the GeneratedImage Control

CodePlex is Microsoft’s open source project community and provides a free hosting platform for open source projects created in .NET. Microsoft’s own ASP.NET team has its own CodePlex page – aspnet.CodePlex.com – where they give code previews for upcoming releases. There you’ll find the ASP.NET MVC 1.0 source code, a preview of the ASP.NET AJAX 4.0 Framework, and other future libraries, frameworks, and controls. One of the controls on the ASP.NET team’s CodePlex page that gets little press is the GeneratedImage control .

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