web app datagrid questions

Posted on 2004-10-21
Last Modified: 2010-04-17

     I'm new to web app programming, and am having trouble with a couple of things to do with datagrids.  

1) I set AllowPaging to true and set PageSize to 5 - I get the arrow at the bottom of my grid, but when I click it in the browser, nothing happens.  So apparently I have to program some postback code that changes which page of data to display in the grid.  How do I do this?

2) I can add a "Edit" button to a new column for each row, but is there anyway to just select the row by clicking on it?

3) If not, for #2, then when an edit button is clicked, what variable tells me what index # I'm dealing with in the grid/dataset?


Question by:gleznov
    1 Comment
    LVL 4

    Accepted Solution



    Question 1:

    You have to the current page index to the selected one. See the example below.

    private void DataGrid1_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
          DataGrid1.EditItemIndex = -1;
          DataGrid1.CurrentPageIndex = e.NewPageIndex;
                    DataGrid1.DataSource = //the datasrouce

    Question 2 and 3:

    See this link:


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone. Privacy Policy Terms of Use

    Featured Post

    Learn The Basics of Ethical Hacking & Pen Testing

    Computer and network security is one of the fastest growing and most essential industries in technology, meaning companies will pay big bucks for ethical hackers. This is the perfect course to leap into this lucrative career, learning how to use ethical hacking to reveal ...

    Suggested Solutions

    Title # Comments Views Activity
    Add mobile access to browser application 3 72
    NotAlone Challenge 20 56
    wefewf 2 13
    scoreUp challenge 14 26
    RIA (Rich Internet Application) tools are interactive internet applications which have many of the characteristics of desktop applications. The RIA tools typically deliver output either by the way of a site-specific browser or via browser plug-in. T…
    This is an explanation of a simple data model to help parse a JSON feed
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    875 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now