[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 226
  • Last Modified:

Switch last gridview row to EditMode

I have code to insert a row into a gridview bound by a SqlDataSource and it prepopulates values.  How do I reference the inserted row (the last row of the gridview) and then switch that row to EditMode?

GridView1 is the name

Using VS2008Team, ASP.NET 3.5, SQL Server 2008 Ent

Thanks in advance!
0
cdX
Asked:
cdX
  • 2
2 Solutions
 
princeatapiCommented:
0
 
MentorKCommented:
set the edit index of gridview to newly inserted row before rebinding it to datasource,

this.GridView1.EditIndex = NewRowIndex;
//Databind code here
0
 
cdXAuthor Commented:
I used a combination of both of your comments to come up with the solution.  Thanks!
--INSERT COMMAND Code here--
GridView1.DataBind()
Dim LastRowIndx As Integer
LastRowIndx = GridView1.Rows.Count - 1
GridView1.EditIndex = LastRowIndx

Open in new window

0
 
cdXAuthor Commented:
The fact that I asked two questions actually, and one was solved for each.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now