Ciao,
Ho un arrey, con questo arrey vado a popolare un DataGrid, tutto mi funziona correttamente,
Solo che non mi funziona la paginazione, ovvero quando clicco sui numeriper passare alle pagine successive, mi compare sempre la prima pagina.
Questo è il codiche che utilizzo: per creare il datagrid.
Dim Tabella As New DataTable
Dim dr As DataRow
Tabella.Columns.Add(New DataColumn("Codice <br> Richiesta", GetType(String)))
Tabella.Columns.Add(New DataColumn("Richiesta", GetType(String)))
Tabella.Columns.Add(New DataColumn("Data <br> Richiesta", GetType(String)))
Tabella.Columns.Add(New DataColumn("Priorita", GetType(String)))
Tabella.Columns.Add(New DataColumn("Stato", GetType(String)))
Dim k As Integer
For k = 0 To TicketList.Length() - 1 'Ciclo sulle righe
'*********** Compongo Le Celle ****************************
dr = Tabella.NewRow()
dr(0) = "<a href=DettaglioChiamata.aspx?TicketID=" + TicketList(k).Case_ID + ">" + TicketList(k).Case_ID + "</a>"
dr(1) = TicketList(k).Summary
dr(2) = TicketList(k).Create_Time
dr(3) = icketList(k).Priorita
dr(4) = TicketList(k).Status
Tabella.Rows.Add(dr)
Next k
Dim dv As New DataView(Tabella)
' Load this data only once.
ItemsGrid.DataSource = dv
ItemsGrid.DataBind()
Questo è il codiche totale della pagina.
Imports System.Data
Public Class Segnalazioni
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents VisualizzaStatoTicket As System.Web.UI.WebControls.DropDownList
Protected WithEvents Form1 As System.Web.UI.HtmlControls.HtmlForm
Protected WithEvents Panel As System.Web.UI.WebControls.Panel
Protected WithEvents t1 As System.Web.UI.HtmlControls.HtmlTable
Protected WithEvents ItemsGrid As System.Web.UI.WebControls.DataGrid
Protected WithEvents noTicket As System.Web.UI.WebControls.Label
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim TicketList As UNIBO_TicketList.GetListOutputMapGetListValues()
Dim TicketService As UNIBO_TicketList.UNIBO_TicketListService
Dim Priorita As String
Dim Stato As String
Dim qualification As String
Dim i As Integer
Dim col As Integer
Dim row As Integer
Dim authInfo As UNIBO_TicketList.AuthenticationInfo
On Error Resume Next
authInfo = New UNIBO_TicketList.AuthenticationInfo
authInfo.userName = "Massimo"
authInfo.password = "kid"
TicketService = New UNIBO_TicketList.UNIBO_TicketListService
TicketService.AuthenticationInfoValue = authInfo
If VisualizzaStatoTicket.SelectedValue = "Tutte" Then
qualification = "('230000009'=" + """" + "MAINHELPDESK" + """" + ") AND ('2'=" + """" + authInfo.userName + """" + ")" 'Con Filtro
Else
' qualification = "('230000000'=" + """" + "MAINHELPDESK" + """" + ") AND ('200000003'=" + """" + "Servizi IT" + """" + ") AND ('7' = 0)"
qualification = "('230000009'=" + """" + "MAINHELPDESK" + """" + ") AND ('2'=" + """" + authInfo.userName + """" + ") AND ('7' < 5)" 'Con Filtro
End If
TicketList = TicketService.OpGetList(qualification)
If TicketList.Length = Nothing Then
noTicket.Visible = True
noTicket.Text = "Nessun ticket presente nel Database."
Else
If Not IsPostBack Then
Dim Tabella As New DataTable
Dim dr As DataRow
Tabella.Columns.Add(New DataColumn("Codice <br> Richiesta", GetType(String)))
Tabella.Columns.Add(New DataColumn("Richiesta", GetType(String)))
Tabella.Columns.Add(New DataColumn("Data <br> Richiesta", GetType(String)))
Tabella.Columns.Add(New DataColumn("Priorita", GetType(String)))
Tabella.Columns.Add(New DataColumn("Stato", GetType(String)))
Dim k As Integer
For k = 0 To TicketList.Length() - 1 'Ciclo sulle righe
'*********** Compongo Le Celle ****************************
dr = Tabella.NewRow()
dr(0) = "<a href=DettaglioChiamata.aspx?TicketID=" + TicketList(k).Case_ID + ">" + TicketList(k).Case_ID + "</a>"
dr(1) = TicketList(k).Summary
dr(2) = TicketList(k).Create_Time
Select Case TicketList(k).Request_Urgency.ToString '****GESTIONE PRIORITA****
Case "Low"
Priorita = "Bassa"
Case "Urgent"
Priorita = "Urgente"
End Select
dr(3) = Priorita
Dim str As String = TicketList(k).Status
Select Case TicketList(k).Status.ToString '****GESTIONE STATO****
Case "New"
Stato = "Nuovo"
Case "Assigned"
Stato = "Assegnato"
Case "Work In Progress"
Stato = "In Lavorazione"
Case "Pending"
Stato = "Sospeso"
Case "Resolved"
Stato = "Risolto"
Case "Closed"
Stato = "Chiuso"
End Select
dr(4) = Stato
Tabella.Rows.Add(dr)
Next k
Dim dv As New DataView(Tabella)
' Load this data only once.
ItemsGrid.DataSource = dv
ItemsGrid.DataBind()
End If
End If
End Sub
End Class