473,748 Members | 2,551 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

v.urgent-need advise-cant sort the datagrid properly

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

Jan 27 '06 #1
0 1073

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
4315
by: Stefan Bauer | last post by:
Hi NG, we've got a very urgent problem... :( We are importing data with the LOAD utility. The input DATE field data is in the format DDMMYYYY (for days) and MMYYYY (for months). The target data format is european DD.MM.YYYY (for days) and 01.MM.YYYY (for months). The input format is not recognizable as a DATE input to a DB2 LOAD for
28
3062
by: Tamir Khason | last post by:
Follwing the struct: public struct TpSomeMsgRep { public uint SomeId;
16
2964
by: | last post by:
Hi all, I have a website running on beta 2.0 on server 2003 web sp1 and I keep getting the following error:- Error In: http://www.mywebsite.org/WebResource.axd?d=5WvLfhnJp5Lc8WhQSD4gdA2&t=632614619884218750 -------------------------------------------------------------------------------- System.Security.Cryptography.CryptographicException: Padding is invalid and cannot be removed. at...
3
6473
by: N. Spiker | last post by:
I am attempting to receive a single TCP packet with some text ending with carriage return and line feed characters. When the text is send and the packet has the urgent flag set, the text read from the socket is missing the last character (line feed). When the same text is sent without the urgent flag set, all of the characters are read. I'm reading the data using the blocking read call of the network stream class. The .NET...
7
5985
by: Cirene | last post by:
I used to use the Web Deployment Project with my VS2005 projects. Now I've fully upgraded to VS2008. Do I have to download a new version of the Web Deployment Project? If so where can I find it? If not, how do I have to change my deployment strategy? Thanks!
0
8996
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8832
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9386
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8255
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6799
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6078
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4608
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3319
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.