web app datagrid questions


     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?


Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

SicosConnect With a Mentor Commented:


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: http://www.dotnetbips.com/displayarticle.aspx?id=147

All Courses

From novice to tech pro — start learning today.