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.EventArg s) Handles MyBase.Load
If Not Me.IsPostBack Then
GetDeptOfUserLo gged()
strSQL = "select FILEID, FILENAME,
APPSERVICETYPE, LOCATION,FILERE PORT, DESCRIPTION, location2 FROM
DOWNLOADFILES WHERE (@lower(ORGANIS ATION)=@lower(' " & Session("Orgn") &
"') or @lower(ORGANISA TION)='merha') and FILEREPORT='REP ORT' 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,APPSER VICETYPE,LOCATI ON,FILEREPORT, DESCRIPTION, location2
FROM DOWNLOADFILES WHERE (@lower(ORGANIS ATION)=@lower(' " & Orgn & "')
or @lower(ORGANISA TION)='merha') and FILEREPORT='REP ORT' order by
APPSERVICETYPE, FILENAME "
objCommand = New OleDbCommand(st rSQL, objConnection)
myDa.SelectComm and = objCommand
Dim dt As New DataTable
myDa.Fill(dt)
Me.dgFiles.Data Source = dt
Me.dgFiles.Data Bind()
Catch ex As Exception
lblError.Text = "bindGrid() : " & ex.Message.ToSt ring
Finally
GoToDBCloseConn ()
End Try
End Sub
Sub SortCommand_OnC lick(ByVal Source As Object, ByVal E As
System.Web.UI.W ebControls.Data GridSortCommand EventArgs)
strSQL = "select FILEID, FILENAME,
APPSERVICETYPE, LOCATION,FILERE PORT, DESCRIPTION, location2 FROM
DOWNLOADFILES WHERE (@lower(ORGANIS ATION)=@lower(' " & Session("Orgn") &
"') or @lower(ORGANISA TION)='merha') and FILEREPORT='REP ORT'"
GoToDBOpenConn( )
myDa.SelectComm and = New
System.Data.Ole Db.OleDbCommand (strSQL, objConnection)
myDa.Fill(myDS)
myDS.Tables(0). Columns.Add(New DataColumn("lbl 2",
System.Type.Get Type("System.Da teTime")))
myDS.Tables(0). Columns.Add(New DataColumn("lbl ",
System.Type.Get Type("System.In t32")))
Dim objView As New DataView(myDS.T ables(0))
objView.Sort = E.SortExpressio n() & " DESC"
dgFiles.DataSou rce = objView
dgFiles.DataBin d()
End Sub
Private Sub dgFiles_ItemDat aBound(ByVal sender As Object, ByVal e As
System.Web.UI.W ebControls.Data GridItemEventAr gs) Handles
dgFiles.ItemDat aBound
If e.Item.ItemType =
System.Web.UI.W ebControls.List ItemType.Altern atingItem Or
e.Item.ItemType = System.Web.UI.W ebControls.List ItemType.Item Or
e.Item.ItemType = System.Web.UI.W ebControls.List ItemType.EditIt em Then
Dim lbl, lbl2 As System.Web.UI.W ebControls.Labe l
Dim row As DataRowView = CType(e.Item.Da taItem,
DataRowView)
lbl = e.Item.FindCont rol("lblSize")
lbl2 = e.Item.FindCont rol("lblMdDate" )
Dim phyPath As String
phyPath =
Server.MapPath( ByteArrayToStri ng(row("LOCATIO N")))
e.Item.Cells(2) .Text = phyPath
FilePath = e.Item.Cells(2) .Text
filename = e.Item.Cells(3) .Text
Dim fi As FileInfo = New FileInfo(FilePa th & filename)
Dim fileBytes As Integer = (fi.Length / 1024)
Dim lastmodifeddt As DateTime =
File.GetLastWri teTime(FilePath & filename)
lbl.Text = fileBytes
lbl2.Text = lastmodifeddt.T oShortDateStrin g
'.ToString("dd MMM yyyy")
Dim urlParams As String = "FileID=" +
row("FILEID").T oString()
Dim tabid As Int32 = 185 'row("TABID1")
e.Item.Cells(4) .Text = "<A href='" &
DotNetNuke.Comm on.Globals.Navi gateURL(tabid, "", urlParams) & "'
target=""_paren t"">" + ByteArrayToStri ng(row("DESCRIP TION")) & "</A>"
End If
End Sub