GridView as email attachment

How do I send the contents of a GridView as an email attachment? GridView can be rendered into a string using the RenderControl() method. From the string, a buffer (of bytes) can be extracted assuming ASCII encoding. This buffer can be used as email attachment by streaming it through a MemoryStream object. The code is below:

 

Read more

Sorted GridView order

I am using JQuery to sort my GridView. I want to save the GridView as excel. But excel does not contain the sorted order. How can I send the sorted order to the server? This can be accomplished by having an additional TemplateField with a HiddenField. The HTML markup for Gridview will look like this:

The javascript for saving[…]

Read more

Image with Text for Verification

I want to create an image with text for verification, similar to the ones used in Google, Yahoo in user registration. How can I create this? The HTML markup for the sample page with image verification will look like something like this:

The image is rendered using a ImageViewer.ashx handler. The textbox text is verified using a CustomValidator. In[…]

Read more

Dynamically creating rows of textboxes

How do I add textboxes to an existing table of textboxes? How do I retrieve the values of the newly added textboxes? The challenge here is that dynamically added controls are not automatically recreated for you by the ASP.Net framework on page postback. This means if you create textboxes dynamically, then you have to re-create these textboxes on every postback.[…]

Read more