Thursday, September 15, 2011

GridView Vertical text in headers

http://forums.asp.net/t/1049758.aspx/1




.verticaltext

{

font:bold 10px Tahoma;

color: #0000FF;

writing-mode: tb-rl;

filter: flipH() flipV();

}

So what I am doing is loading my gridview like usual, and then adding a _DataBound event for the gridview.  So here is the code to rotate the header row.

Protected Sub gvMatrix_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles gvMatrix.DataBound

Dim style As New Web.UI.WebControls.Style

Dim row As GridViewRow = gvMatrix.HeaderRow

style.CssClass = "verticaltext"

For Each cell As TableCell In row.Cells

cell.ApplyStyle(style)

Next

end sub

Friday, September 2, 2011

Paging at DAL




PAGING AT DAL

1. http://www.codeproject.com/KB/webforms/GridViewCustomPaging.aspx
====================================================================
CREATE PROCEDURE [usp_GetProducts]
@startRowIndex int,
@maximumRows int,
@totalRows int OUTPUT

AS

DECLARE @first_id int, @startRow int

SET @startRowIndex =  (@startRowIndex - 1)  * @maximumRows

IF @startRowIndex = 0
SET @startRowIndex = 1

SET ROWCOUNT @startRowIndex

SELECT @first_id = ProductID FROM Products ORDER BY ProductID

PRINT @first_id

SET ROWCOUNT @maximumRows

SELECT ProductID, ProductName FROM Products WHERE
ProductID >= @first_id
ORDER BY ProductID

SET ROWCOUNT 0

-- GEt the total rows

SELECT @totalRows = COUNT(ProductID) FROM Products
GO
====================================================================

2. http://www.aspsnippets.com/Articles/Custom-Paging-in-ASP.Net-GridView-using-SQL-Server-Stored-Procedure.aspx

====================================================================
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
CREATE PROCEDURE GetCustomersPageWise
      @PageIndex INT = 1
      ,@PageSize INT = 10
      ,@RecordCount INT OUTPUT
AS
BEGIN
      SET NOCOUNT ON;
      SELECT ROW_NUMBER() OVER
      (
            ORDER BY [CustomerID] ASC
      )AS RowNumber
      ,[CustomerID]
      ,[CompanyName]
      ,[ContactName]
     INTO #Results
      FROM [Customers]
     
      SELECT @RecordCount = COUNT(*)
      FROM #Results
           
      SELECT * FROM #Results
      WHERE RowNumber BETWEEN(@PageIndex -1) * @PageSize + 1 AND(((@PageIndex -1) * @PageSize + 1) + @PageSize) - 1
     
      DROP TABLE #Results
END
GO
====================================================================

 using Microsoft.AspNetCore.Mvc; using System.Xml.Linq; using System.Xml.XPath; //<table class="common-table medium js-table js-stre...