I
importantEmail
hi
i have pasted page_load, my bindgrid, sort and itemdatabound event.
my sorting in not working properly...i tried a couple of ways but there
is something i am missing.
pls suggest me on this .... i hadnt been able to figure out the
solution for this.
here is the original display in the dg==>
Category Description Size(KB) Last Modified
DESKTOP sql engg 397 Jul 28, 2005
DESKTOP relnote 117 Dec 11, 2002
SERVER bullying 92 Aug 23, 2005
SERVER ensuring 73 Aug 23, 2005
SERVER portal users 18 Nov 22, 2005
and after i sort by size here is what i get==>
SERVER ensuring 73 Aug 23, 2005
SERVER bullying 92 Aug 23, 2005
DESKTOP sql engg 397 Jul 28, 2005
SERVER portal users 18 Nov 22, 2005
DESKTOP relnote 117 Dec 11, 2002
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not Me.IsPostBack Then
GetDeptOfUserLogged()
strSQL = "select FILEID, FILENAME,
APPSERVICETYPE,LOCATION,FILEREPORT, DESCRIPTION, location2 FROM
DOWNLOADFILES WHERE (@lower(ORGANISATION)=@lower('" & Session("Orgn") &
"') or @lower(ORGANISATION)='merha') and FILEREPORT='REPORT' order by
APPSERVICETYPE, FILENAME "
bindGrid2()
End If
End Sub
Public Sub bindGrid2()
Try
Page.Validate()
If Not Page.IsValid Then
Return
End If
GoToDBOpenConn()
strSQL = "select FILEID,
FILENAME,APPSERVICETYPE,LOCATION,FILEREPORT, DESCRIPTION, location2
FROM DOWNLOADFILES WHERE (@lower(ORGANISATION)=@lower('" & Orgn & "')
or @lower(ORGANISATION)='merha') and FILEREPORT='REPORT' order by
APPSERVICETYPE, FILENAME "
objCommand = New OleDbCommand(strSQL, objConnection)
myDa.SelectCommand = objCommand
Dim dt As New DataTable
myDa.Fill(dt)
Me.dgFiles.DataSource = dt
Me.dgFiles.DataBind()
Catch ex As Exception
lblError.Text = "bindGrid(): " & ex.Message.ToString
Finally
GoToDBCloseConn()
End Try
End Sub
Sub SortCommand_OnClick(ByVal Source As Object, ByVal E As
System.Web.UI.WebControls.DataGridSortCommandEventArgs)
strSQL = "select FILEID, FILENAME,
APPSERVICETYPE,LOCATION,FILEREPORT, DESCRIPTION, location2 FROM
DOWNLOADFILES WHERE (@lower(ORGANISATION)=@lower('" & Session("Orgn") &
"') or @lower(ORGANISATION)='merha') and FILEREPORT='REPORT'"
GoToDBOpenConn()
myDa.SelectCommand = New
System.Data.OleDb.OleDbCommand(strSQL, objConnection)
myDa.Fill(myDS)
myDS.Tables(0).Columns.Add(New DataColumn("lbl2",
System.Type.GetType("System.DateTime")))
myDS.Tables(0).Columns.Add(New DataColumn("lbl",
System.Type.GetType("System.Int32")))
Dim objView As New DataView(myDS.Tables(0))
objView.Sort = E.SortExpression() & " DESC"
dgFiles.DataSource = objView
dgFiles.DataBind()
End Sub
Private Sub dgFiles_ItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles
dgFiles.ItemDataBound
If e.Item.ItemType =
System.Web.UI.WebControls.ListItemType.AlternatingItem Or
e.Item.ItemType = System.Web.UI.WebControls.ListItemType.Item Or
e.Item.ItemType = System.Web.UI.WebControls.ListItemType.EditItem Then
Dim lbl, lbl2 As System.Web.UI.WebControls.Label
Dim row As DataRowView = CType(e.Item.DataItem,
DataRowView)
lbl = e.Item.FindControl("lblSize")
lbl2 = e.Item.FindControl("lblMdDate")
Dim phyPath As String
phyPath =
Server.MapPath(ByteArrayToString(row("LOCATION")))
e.Item.Cells(2).Text = phyPath
FilePath = e.Item.Cells(2).Text
filename = e.Item.Cells(3).Text
Dim fi As FileInfo = New FileInfo(FilePath & filename)
Dim fileBytes As Integer = (fi.Length / 1024)
Dim lastmodifeddt As DateTime =
File.GetLastWriteTime(FilePath & filename)
lbl.Text = fileBytes
lbl2.Text = lastmodifeddt.ToShortDateString
'.ToString("dd MMM yyyy")
Dim urlParams As String = "FileID=" +
row("FILEID").ToString()
Dim tabid As Int32 = 185 'row("TABID1")
e.Item.Cells(4).Text = "<A href='" &
DotNetNuke.Common.Globals.NavigateURL(tabid, "", urlParams) & "'
target=""_parent"">" + ByteArrayToString(row("DESCRIPTION")) & "</A>"
End If
End Sub
i have pasted page_load, my bindgrid, sort and itemdatabound event.
my sorting in not working properly...i tried a couple of ways but there
is something i am missing.
pls suggest me on this .... i hadnt been able to figure out the
solution for this.
here is the original display in the dg==>
Category Description Size(KB) Last Modified
DESKTOP sql engg 397 Jul 28, 2005
DESKTOP relnote 117 Dec 11, 2002
SERVER bullying 92 Aug 23, 2005
SERVER ensuring 73 Aug 23, 2005
SERVER portal users 18 Nov 22, 2005
and after i sort by size here is what i get==>
SERVER ensuring 73 Aug 23, 2005
SERVER bullying 92 Aug 23, 2005
DESKTOP sql engg 397 Jul 28, 2005
SERVER portal users 18 Nov 22, 2005
DESKTOP relnote 117 Dec 11, 2002
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not Me.IsPostBack Then
GetDeptOfUserLogged()
strSQL = "select FILEID, FILENAME,
APPSERVICETYPE,LOCATION,FILEREPORT, DESCRIPTION, location2 FROM
DOWNLOADFILES WHERE (@lower(ORGANISATION)=@lower('" & Session("Orgn") &
"') or @lower(ORGANISATION)='merha') and FILEREPORT='REPORT' order by
APPSERVICETYPE, FILENAME "
bindGrid2()
End If
End Sub
Public Sub bindGrid2()
Try
Page.Validate()
If Not Page.IsValid Then
Return
End If
GoToDBOpenConn()
strSQL = "select FILEID,
FILENAME,APPSERVICETYPE,LOCATION,FILEREPORT, DESCRIPTION, location2
FROM DOWNLOADFILES WHERE (@lower(ORGANISATION)=@lower('" & Orgn & "')
or @lower(ORGANISATION)='merha') and FILEREPORT='REPORT' order by
APPSERVICETYPE, FILENAME "
objCommand = New OleDbCommand(strSQL, objConnection)
myDa.SelectCommand = objCommand
Dim dt As New DataTable
myDa.Fill(dt)
Me.dgFiles.DataSource = dt
Me.dgFiles.DataBind()
Catch ex As Exception
lblError.Text = "bindGrid(): " & ex.Message.ToString
Finally
GoToDBCloseConn()
End Try
End Sub
Sub SortCommand_OnClick(ByVal Source As Object, ByVal E As
System.Web.UI.WebControls.DataGridSortCommandEventArgs)
strSQL = "select FILEID, FILENAME,
APPSERVICETYPE,LOCATION,FILEREPORT, DESCRIPTION, location2 FROM
DOWNLOADFILES WHERE (@lower(ORGANISATION)=@lower('" & Session("Orgn") &
"') or @lower(ORGANISATION)='merha') and FILEREPORT='REPORT'"
GoToDBOpenConn()
myDa.SelectCommand = New
System.Data.OleDb.OleDbCommand(strSQL, objConnection)
myDa.Fill(myDS)
myDS.Tables(0).Columns.Add(New DataColumn("lbl2",
System.Type.GetType("System.DateTime")))
myDS.Tables(0).Columns.Add(New DataColumn("lbl",
System.Type.GetType("System.Int32")))
Dim objView As New DataView(myDS.Tables(0))
objView.Sort = E.SortExpression() & " DESC"
dgFiles.DataSource = objView
dgFiles.DataBind()
End Sub
Private Sub dgFiles_ItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles
dgFiles.ItemDataBound
If e.Item.ItemType =
System.Web.UI.WebControls.ListItemType.AlternatingItem Or
e.Item.ItemType = System.Web.UI.WebControls.ListItemType.Item Or
e.Item.ItemType = System.Web.UI.WebControls.ListItemType.EditItem Then
Dim lbl, lbl2 As System.Web.UI.WebControls.Label
Dim row As DataRowView = CType(e.Item.DataItem,
DataRowView)
lbl = e.Item.FindControl("lblSize")
lbl2 = e.Item.FindControl("lblMdDate")
Dim phyPath As String
phyPath =
Server.MapPath(ByteArrayToString(row("LOCATION")))
e.Item.Cells(2).Text = phyPath
FilePath = e.Item.Cells(2).Text
filename = e.Item.Cells(3).Text
Dim fi As FileInfo = New FileInfo(FilePath & filename)
Dim fileBytes As Integer = (fi.Length / 1024)
Dim lastmodifeddt As DateTime =
File.GetLastWriteTime(FilePath & filename)
lbl.Text = fileBytes
lbl2.Text = lastmodifeddt.ToShortDateString
'.ToString("dd MMM yyyy")
Dim urlParams As String = "FileID=" +
row("FILEID").ToString()
Dim tabid As Int32 = 185 'row("TABID1")
e.Item.Cells(4).Text = "<A href='" &
DotNetNuke.Common.Globals.NavigateURL(tabid, "", urlParams) & "'
target=""_parent"">" + ByteArrayToString(row("DESCRIPTION")) & "</A>"
End If
End Sub