hice los cambios que me indicaste pero al hacer cambio de pagina me arroja el siguiente error
No se puede encontrar la columna LugarDESC. lugar es el nombre de la columna
aqui te envio el codigo para que lo veas el error se me produce en las lines que estan marcadas con negrita
Sub pagerbuttonclick(ByVal sender As Object, ByVal e As EventArgs)
Dim arg As String = sender.commandargument
Select Case arg
Case "siguiente"
If (DataGrid1.CurrentPageIndex < (DataGrid1.PageCount - 1)) Then
DataGrid1.CurrentPageIndex += 1
End If
Case "anterior"
If (DataGrid1.CurrentPageIndex > 0) Then
DataGrid1.CurrentPageIndex -= 1
End If
Case "ultima"
DataGrid1.CurrentPageIndex = (DataGrid1.PageCount - 1)
Case "primera"
DataGrid1.CurrentPageIndex = 0
End Select
'DataGrid1.DataSource = MyQueryMethod(CStr(textbox1.text))
If campoorden.Text = "" Then
DataGrid1.DataSource = MyQueryMethod(DropDownList1.SelectedItem.Text(), IIf((campoitem.Text = ""), "", DropDownList3.SelectedItem.Text), IIf((campoequipo.Text = ""), "", DropDownList4.SelectedItem.Text), IIf((campolugar.Text = ""), "", DropDownList5.SelectedItem.Text))
Else
Dim dv As New System.Data.DataView()
dv.Table = MyQueryMethod(DropDownList1.SelectedItem.Text, IIf((campoitem.Text = ""), "", DropDownList3.SelectedItem.Text), IIf((campoequipo.Text = ""), "", DropDownList4.SelectedItem.Text), IIf((campolugar.Text = ""), "", DropDownList5.SelectedItem.Text)).Tables(0) dv.Sort = campoorden.Text
DataGrid1.DataSource = dv
End If
DataGrid1.DataBind()
End Sub
Sub mi_cambio(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridPageChangedEvent Args)
DataGrid1.CurrentPageIndex = e.NewPageIndex
'datagrid1.datasource=myquerymethod(cstr(textbox1. text))
If campoorden.Text = "" Then
DataGrid1.DataSource = MyQueryMethod(DropDownList1.SelectedItem.Text(), IIf((campoitem.Text = ""), "", DropDownList3.SelectedItem.Text), IIf((campoequipo.Text = ""), "", DropDownList4.SelectedItem.Text), IIf((campolugar.Text = ""), "", DropDownList5.SelectedItem.Text))
Else
Dim dv As New System.Data.DataView()
dv.Table = MyQueryMethod(DropDownList1.Items(DropDownList1.Se lectedIndex).Text, IIf((campoitem.Text = ""), "", DropDownList3.SelectedItem.Text), IIf((campoequipo.Text = ""), "", DropDownList4.SelectedItem.Text), IIf((campolugar.Text = ""), "", DropDownList5.SelectedItem.Text)).Tables(0) dv.Sort = campoorden.Text
DataGrid1.DataSource = dv
End If
DataGrid1.DataBind()
End Sub
Sub orden(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridSortCommandEvent Args)
Dim dv As New System.Data.DataView()
Dim strorden As String
dv.Table = MyQueryMethod(DropDownList1.Items(DropDownList1.Se lectedIndex).Text, IIf((campoitem.Text = ""), "", DropDownList3.SelectedItem.Text), IIf((campoequipo.Text = ""), "", DropDownList4.SelectedItem.Text), IIf((campolugar.Text = ""), "", DropDownList5.SelectedItem.Text)).Tables(0)
If viewstate("vcolumna") = e.SortExpression Then
If viewstate("vorden") = "ASC" Then
dv.Sort = e.SortExpression & " " & "DESC"
campoorden.Text = e.SortExpression & " " & "DESC"
viewstate("vorden") = "DESC"
Else
dv.Sort = e.SortExpression & " " & "ASC"
campoorden.Text = e.SortExpression & " " & "ASC"
viewstate("vorden") = "ASC"
End If
Else
viewstate("vcolumna") = e.SortExpression
dv.Sort = e.SortExpression & " " & "ASC"
campoorden.Text = e.SortExpression & " " & "ASC"
viewstate("vorden") = "ASC"
End If
DataGrid1.DataSource = dv
DataGrid1.DataBind()
campoorden.Text = e.SortExpression + "" + viewstate("vorden")
End Sub |