To all. I figured this one out. I have included my source code for anyone who
may need it:
Protected Sub frmView_ItemInserted(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.FormViewInsertedEventArg s) Handles
frmView.ItemInserted
Dim dv As DataView =
CType(sql.Select(DataSourceSelectArguments.Empty), DataView)
Dim empLoc As String = CType(Session("EmpLoc"), String)
Dim employee As String = CType(Session("Employee"), String)
Dim key(1) As Object
Dim selectKey As Integer = -1
Dim selectPage As Integer = 1
key(0) = empLoc
key(1) = employee
dv.Sort = "EmpLoc, Employee"
selectKey = dv.Find(key)
selectPage = selectKey / gvPhone.PageSize
If selectKey Mod gvPhone.PageSize = 0 Then selectPage -= 1
gvPhone.PageIndex = selectPage
selectKey -= selectPage * gvPhone.PageSize
gvPhone.SelectedIndex = selectKey
Response.Write("selectKey: " + selectKey.ToString + "<br />")
Response.Write("selectPage: " + selectPage.ToString)
End Sub
Protected Sub frmView_ItemInserting(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.FormViewInsertEventArgs) Handles
frmView.ItemInserting
Session("EmpLoc") = e.Values.Item(2).ToString
Session("Employee") = e.Values.Item(1).ToString
End Sub
Tahnks...
"John Daly" wrote:
I am using a Gridview to display a phone directory, with paging on. I have a
link button that a user clicks to add a new record, which reloads the page,
sets the visble property to false on the gridview and shows the form view in
insert mode. Upon saving, the process is reversed. All is well and dandy,
however I want to jump to the page that has the newly entered record, with
the record highlighted. Does anyone know how to do this?
I believe I would need a dataview to find the inserted record and to get
it's row index, but I do not know how to get the dataview from a
SQLDATASOURCE.