Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 19th, 2006, 05:50 PM
Registered User
 
Join Date: Jun 2005
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Datagrid Editcommand for 1 rcrd on 2nd page

Step 1: In my datagrid, if I click on the only row on the second page, it takes me to the first record on the first page.

Step 2: If I add a second row to the second page, then click "Edit" on the top / first record on the second page, I can now edit that record that I couldn't edit in Step 1.

Here's the Editcommand code:

DataGrid1.EditItemIndex = e.Item.ItemIndex

SqlDataAdapter1.Fill(Dssqla1, "Resource Table")
SqlDataAdapter2.Fill(Dssqlb1, "Resource Table - Combo Codes")
SqlDataAdapter3.Fill(Dssqlc1, "Signature_Authority_Names")

DataGrid1.DataBind()

Things I'm looking at are:
1. The original datagrid on the EditCommand event simply populated dropdownlists in several of the fields in the datagrid. This worked fine, but the width allotment wasn't enough. These ddls were small and difficult for users to read.

2. The new datagrid had the EditItem template changed and all three dropdownlists were placed in the same column to allow for the dropdownlists to have enough width and ample font size. It made the datagrid better from a UI perspective.

I can't see anything different in the datagrid EditCommand in either version of the code. The ItemDataBound routine is the same too.

I can look at the record in question (only record on second page) and paste the following data in a label of:

lblItemIndex.Text = e.Item.ItemIndex.ToString() lblItemIndex &= " " & DataGrid1.CurrentPageIndex
lblItemIndex.Text &= " " & e.Item.Cells(15).Text.toString()

...this label shows that I'm in fact clicking on that only record on the second page, but still the Datagrid goes to the first record on the first page. If I add another record, so now the second page has two records, I can then edit this particular record on the second page.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom paging in Datagrid with datagrid page count madhusrp ASP.NET 1.0 and 1.1 Professional 12 June 2nd, 2008 01:15 PM
datagrid editcommand firing but not editTemplate janetb ASP.NET 2.0 Basics 0 March 27th, 2008 01:14 PM
datagrid does not display next page vhrao ASP.NET 2.0 Basics 9 July 22nd, 2007 12:28 AM
The page cannot be displayed Datagrid Jose Fidalgo ASP.NET 1.0 and 1.1 Professional 1 September 26th, 2006 06:10 AM
Page 160 Error (2nd instance) and FIX. VictorVictor BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 January 27th, 2006 04:21 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.