Posts

Showing posts from November, 2011

Create Excel File From DataTable

Hello Friends, Many times we need to create Excel files in our application using existing Data. I have figured out a class which will help to create excel file by just passing DataTable and preferred location to generate on server. please download the cs file from here .. and use it :) here is full code using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data; using System.Xml; public class ExcelHelper { private static readonly ExcelHelper _instance = new ExcelHelper(); public static ExcelHelper Instance { get { return _instance; } } /// <summary> /// Create one Excel-XML-Document with SpreadsheetML from a DataTable /// </summary> /// <param name="dataSource">Datasource which would be exported in Excel</param> /// <param name="fileName">Name of exported file</param> public ...

Scroll to particular record in GridView

Hello Friends, here is a tip to scroll the gridview to particular record. the basic concept is html scrolling. to scroll at particular position create an anchor tag with name as address (eg. #ScrollPoint '# is must') now redirect the page to the location using javascript call window.location.href = "#ScrollPoint";   same thing can be achieved by anchorlink href here is sample code HTML Page <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox> <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="return MoveTo();" /> <div style="height: 100px; overflow: auto;"> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false"> <Columns> <asp:TemplateField HeaderText="ID" SortExpression="ID"> <EditItemTemplate...