D
Dave
Hello All,
I am having a nightmare trying to add a new row to my
Datagrid. When I use the code below I get the
error: 'Invalid CurrentPageIndex value. It must be >= 0
and < the PageCount. Can anyone help me with this?
Dim dg2 as DataGrid = DG.Items(0).FindControl("dg2")
DSClass = Session("DSClass")
dt = DSClass.Tables(0)
dim dr as DataRow = dt.NewRow ()
dt.Rows.Add(dr)
Session("DSClass") = DSClass
dg2.DataSource = Session("DSClass")
intIndex = dg2.Items.Count ''intIndex = 7
If intIndex >= dg2.PageSize Then ''Page Size = 7
''At present CurrentPageIndex = 0
dg2.CurrentPageIndex = dg2.CurrentPageIndex + 1
intIndex = 0
''CurrentPageIndex = 1 And PageCount = 1
End if
dg2.EditItemIndex = intIndex
dg2.Datasource = Session("DSClass").Tables(0)
dg2.DataBind()
''Errors here because CurrentPageIndex = 1 and needs to be
less than 1, but this is not the page I want to be
displayed?
I am having a nightmare trying to add a new row to my
Datagrid. When I use the code below I get the
error: 'Invalid CurrentPageIndex value. It must be >= 0
and < the PageCount. Can anyone help me with this?
Dim dg2 as DataGrid = DG.Items(0).FindControl("dg2")
DSClass = Session("DSClass")
dt = DSClass.Tables(0)
dim dr as DataRow = dt.NewRow ()
dt.Rows.Add(dr)
Session("DSClass") = DSClass
dg2.DataSource = Session("DSClass")
intIndex = dg2.Items.Count ''intIndex = 7
If intIndex >= dg2.PageSize Then ''Page Size = 7
''At present CurrentPageIndex = 0
dg2.CurrentPageIndex = dg2.CurrentPageIndex + 1
intIndex = 0
''CurrentPageIndex = 1 And PageCount = 1
End if
dg2.EditItemIndex = intIndex
dg2.Datasource = Session("DSClass").Tables(0)
dg2.DataBind()
''Errors here because CurrentPageIndex = 1 and needs to be
less than 1, but this is not the page I want to be
displayed?