datagrid in asp.net,c#

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lakshmimalraj
    New Member
    • Jul 2007
    • 2

    datagrid in asp.net,c#

    alphabet paging in datagrid using c#,asp.net
    and to insert empty rows in datagrid using asp.net,c#
  • dip_developer
    Recognized Expert Contributor
    • Aug 2006
    • 648

    #2
    Originally posted by lakshmimalraj
    alphabet paging in datagrid using c#,asp.net
    and to insert empty rows in datagrid using asp.net,c#
    what do u mean by alphabet paging????..... .as far my knowledge your records are sorted in ascending order of the alphabet and you want paging to show the records alphabetwise... .?? Is it??

    in my opinion the best possible way to do this is
    1.Make a general sql query and fill a Dataset with your records.
    2.Make a Dataview with your dataset table.
    3.filter/sort the Dataview.
    4.Then with each sorted recordset fill a grid.
    5.In this grid [with sorted record] apply paging.....Data grid has a PageSize property

    otherwise you can have a single sql query with "order by" clause.You can have a sql stored procedure which can be used to do paging.....here is a sample

    [CODE=sql]
    Stored procedure for paging
    *************** *************** *************** *************** *************** *************** *************** *********
    use northwind
    go
    --create temporary table to store all rows with identity column or serial number for page filter
    CREATE TABLE #OrdersPage ([Iden] [int] IDENTITY(1,1) NOT NULL, OrderId int,CustomerID nchar(10))
    declare @startpage int
    declare @endpage int
    declare @rows int
    declare @currentpage int
    set @rows = 10 -- number of rows per page from the front end
    set @currentpage = 1 -- pass current page from the front end
    set @endpage = (@rows * @currentpage) + 1
    set @startpage = @endpage - @rows
    print @startpage
    print @endpage
    insert into #OrdersPage
    select top 50 OrderID, CustomerID from Orders
    select * from #OrdersPage where Iden >= @startpage and Iden < @endpage
    -- set paging condition here using the column 'Iden' from the temporary table
    drop table #OrdersPage
    [/CODE]

    For your second query see this........... ......
    insert row in a datagrid

    Comment

    Working...