web app datagrid questions

Hi,

     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?

Thanks!

JP
gleznovAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SicosCommented:

Hi,

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
      DataGrid1.DataBind();
}


Question 2 and 3:

See this link: http://www.dotnetbips.com/displayarticle.aspx?id=147

Greetings,
Sicos
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.