Skip to main content

Posts

Showing posts from 2012

DATATABLE CROSS TAB

 public DataTable ConvertToCrossTab(DataTable table)     {         DataTable newTable = new DataTable();         for (int r = 0; r <= table.Rows.Count; r++)         {             newTable.Columns.Add(r.ToString());         }         for (int c = 0; c < table.Columns.Count; c++)         {             DataRow row = newTable.NewRow();             object[] rowValues = new object[table.Rows.Count + 1];             rowValues[0] = table.Columns[c].Caption;             for (int r = 1; r <= table.Rows.Count; r++)             {                 rowValues[r] = table.Rows[r - 1][c].ToString();             }             row.ItemArray = rowValues;             newTable.Rows.Add(row);         }         return newTable;     }

sql to email send

------------first time only --EXEC sp_configure 'show advanced options', 1;    --GO    --RECONFIGURE;    --GO    --EXEC sp_configure 'Ad Hoc Distributed Queries', 1;    --GO    --RECONFIGURE;    --GO    --EXEC sp_configure 'Web Assistant Procedures', 1;    --GO    --RECONFIGURE;    --GO  DECLARE @FinalQuery AS nVARCHAR(max)    set @FinalQuery = 'select * from branch' DECLARE @HEAD AS nVARCHAR(max)    SET @HEAD ='Branch Report '' <br/> visahlasl'    EXEC sp_makewebtask      @outputfile = 'd:\work_mandays.doc',      @query = @FinalQuery,      @colheaders =1,      @FixedFont=0,@lastupdated=0,     @resultstitle=@HEAD        EXEC msdb.dbo.sp_send_dbmail        @profile_name = 'zanvargroup',        @recipients = 'VISHdsf@ddss.com',        @body_format  ='HTML',        @subject = 'Work Mandays BranchWise',        @body  =  'Work Mandays BranchWise',        @file_attachments ='d:\work_ma

Collapsable nested GridView with paging

Collapsable nested GridView with paging In this article we will explore how to do paging in nested collapsable gridview. In this gridview only one child gridview will be visible. One can collapse all the nested gridview, only parent gridview will be visible. The paging index of each child gridview will be retained. Update panel has been used to make the paging smooth and seemless. Let's see how we can do it. Step 1:  Add scriptmanager in the aspx page. < asp : ScriptManager ID ="ScriptManager1" runat ="server" EnablePageMethods ="true"> </ asp : ScriptManager > Step 2: Add a gridview with another gridview in the last templatefield. The last templatefield will also contain a label which will be used as last column in the parent g