hi, i'm having problems with a datagrid paging.
it's populates fine, but when i click the paging button appears this
error:"Specifie d argument was out of the range of valid
values.Paramete r name: index"
I paste the code here in case someone can help me.
Sub paginaNueva(ByV al sender As Object, ByVal e As
System.Web.UI.W ebControls.Data GridPageChanged EventArgs)
DataGrid1.Curre ntPageIndex = e.NewPageIndex
binddata()
End Sub
Sub binddata()
Dim myConnection As New
System.Data.Sql Client.SqlConne ction("myconnec tion_string")
Dim strSQL As String = "SELECT * FROM
SISTEMAS_SIOPEL MEETING_FOTOS WHERE titulo LIKE '%'+'almuerzos' +'%'"
Dim strSQL2 As String = "SELECT * FROM
SISTEMAS_SIOPEL MEETING_FOTOS WHERE titulo LIKE
'%'+'presentaci ones'+'%'"
Dim strSQL3 As String = "SELECT * FROM
SISTEMAS_SIOPEL MEETING_FOTOS WHERE titulo LIKE '%'+'hotel'+'%' "
Dim strSQL4 As String = "SELECT * FROM
SISTEMAS_SIOPEL MEETING_FOTOS WHERE titulo LIKE '%'+'estancia'+ '%'"
Dim myCommand As New System.Data.Sql Client.SqlComma nd(strSQL,
myConnection)
Dim myCommand2 As New
System.Data.Sql Client.SqlComma nd(strSQL2, myConnection)
Dim myCommand3 As New
System.Data.Sql Client.SqlComma nd(strSQL3, myConnection)
Dim myCommand4 As New
System.Data.Sql Client.SqlComma nd(strSQL4, myConnection)
Dim myAdapter As New
System.Data.Sql Client.SqlDataA dapter(myComman d)
Dim myAdapter2 As New
System.Data.Sql Client.SqlDataA dapter(myComman d2)
Dim myAdapter3 As New
System.Data.Sql Client.SqlDataA dapter(myComman d3)
Dim myAdapter4 As New
System.Data.Sql Client.SqlDataA dapter(myComman d4)
Dim ds As New System.Data.Dat aSet()
Dim ds2 As New System.Data.Dat aSet()
Dim ds3 As New System.Data.Dat aSet()
Dim ds4 As New System.Data.Dat aSet()
myAdapter.Fill( ds)
myAdapter2.Fill (ds2)
myAdapter3.Fill (ds3)
myAdapter4.Fill (ds4)
DataGrid1.DataS ource = ds
Datagrid2.DataS ource = ds2
Datagrid3.DataS ource = ds3
Datagrid4.DataS ource = ds4
DataGrid1.DataB ind()
Datagrid2.DataB ind()
Datagrid3.DataB ind()
Datagrid4.DataB ind()
myConnection.Cl ose()
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArg s) Handles Me.Load
If Not Page.IsPostBack Then
binddata()
End If
End Sub
Thanks.
it's populates fine, but when i click the paging button appears this
error:"Specifie d argument was out of the range of valid
values.Paramete r name: index"
I paste the code here in case someone can help me.
Sub paginaNueva(ByV al sender As Object, ByVal e As
System.Web.UI.W ebControls.Data GridPageChanged EventArgs)
DataGrid1.Curre ntPageIndex = e.NewPageIndex
binddata()
End Sub
Sub binddata()
Dim myConnection As New
System.Data.Sql Client.SqlConne ction("myconnec tion_string")
Dim strSQL As String = "SELECT * FROM
SISTEMAS_SIOPEL MEETING_FOTOS WHERE titulo LIKE '%'+'almuerzos' +'%'"
Dim strSQL2 As String = "SELECT * FROM
SISTEMAS_SIOPEL MEETING_FOTOS WHERE titulo LIKE
'%'+'presentaci ones'+'%'"
Dim strSQL3 As String = "SELECT * FROM
SISTEMAS_SIOPEL MEETING_FOTOS WHERE titulo LIKE '%'+'hotel'+'%' "
Dim strSQL4 As String = "SELECT * FROM
SISTEMAS_SIOPEL MEETING_FOTOS WHERE titulo LIKE '%'+'estancia'+ '%'"
Dim myCommand As New System.Data.Sql Client.SqlComma nd(strSQL,
myConnection)
Dim myCommand2 As New
System.Data.Sql Client.SqlComma nd(strSQL2, myConnection)
Dim myCommand3 As New
System.Data.Sql Client.SqlComma nd(strSQL3, myConnection)
Dim myCommand4 As New
System.Data.Sql Client.SqlComma nd(strSQL4, myConnection)
Dim myAdapter As New
System.Data.Sql Client.SqlDataA dapter(myComman d)
Dim myAdapter2 As New
System.Data.Sql Client.SqlDataA dapter(myComman d2)
Dim myAdapter3 As New
System.Data.Sql Client.SqlDataA dapter(myComman d3)
Dim myAdapter4 As New
System.Data.Sql Client.SqlDataA dapter(myComman d4)
Dim ds As New System.Data.Dat aSet()
Dim ds2 As New System.Data.Dat aSet()
Dim ds3 As New System.Data.Dat aSet()
Dim ds4 As New System.Data.Dat aSet()
myAdapter.Fill( ds)
myAdapter2.Fill (ds2)
myAdapter3.Fill (ds3)
myAdapter4.Fill (ds4)
DataGrid1.DataS ource = ds
Datagrid2.DataS ource = ds2
Datagrid3.DataS ource = ds3
Datagrid4.DataS ource = ds4
DataGrid1.DataB ind()
Datagrid2.DataB ind()
Datagrid3.DataB ind()
Datagrid4.DataB ind()
myConnection.Cl ose()
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArg s) Handles Me.Load
If Not Page.IsPostBack Then
binddata()
End If
End Sub
Thanks.
Comment