473,386 Members | 1,795 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

urg-how to sort datagrid having calculated column

hi
i have a datagrid where i display some columns. i want to have some
columns from the db and 2 i calculate,i can display it but problem is
how to sort the calculated columns.
here is what i am doing right now:

on page load i have:
If Not Me.IsPostBack Then
strSQL = "select FILEID, FILENAME,
APPSERVICETYPE,LOCATION,FILEREPORT, DESCRIPTION, location2 FROM
DOWNLOADFILES WHERE (@lower(ORGANISATION)=@lower('" & Orgn & "') or
@lower(ORGANISATION)='dfe') and FILEREPORT='REPORT' order by
APPSERVICETYPE, FILENAME "
bindGrid()
End If
and in bindgrid i have :
GoToDBOpenConn()
bjCommand = New OleDbCommand(strSQL, objConnection)
myDa.SelectCommand = objCommand
Dim dt As New DataTable
myDa.Fill(dt)
Me.dgFiles.DataSource = dt
Me.dgFiles.DataBind()

in itemdatabound i calculate the columns
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.Alternating Item 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 Date =
File.GetLastWriteTime(FilePath & filename)
lastmodifeddt = lastmodifeddt.Date
lbl.Text = fileBytes.ToString
lbl2.Text = lastmodifeddt

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

now when i sort right i am having:
Sub SortCommand_OnClick(ByVal Source As Object, ByVal E As
System.Web.UI.WebControls.DataGridSortCommandEvent Args)
strSQL = "select FILEID, FILENAME,
APPSERVICETYPE,LOCATION,FILEREPORT, DESCRIPTION, location2 FROM
DOWNLOADFILES WHERE (@lower(ORGANISATION)=@lower('" & Orgn & "') or
@lower(ORGANISATION)='dfe') and FILEREPORT='REPORT' ORDER BY " &
E.SortExpression()
GetDeptOfUserLogged()
bindGrid()
End Sub

but here if i sort the caluclated columns then that column doesnt exists
in db? how can this issue be resolved. can anyone help on this?
thanks a lot


--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com
Dec 21 '05 #1
0 1065

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

Similar topics

2
by: KK | last post by:
Hi Peoples, Can anyone give me any learning materials for learning C++. i.e. can you give me any docs or give me the link to any website that has info on programming in general or C++. (ok...
12
by: Iain Downie | last post by:
Dear list, we are getting a few folk trying to register for our birdwatching surveys with emails of the form: aname@phonecoop.coop, in other words with a 4 character ending (other examples are...
20
by: __PPS__ | last post by:
Hello everybody in a quiz I had a question about dangling pointer: "What a dangling pointer is and the danger of using it" My answer was: "dangling pointer is a pointer that points to some...
6
by: Alf P. Steinbach | last post by:
One main usage of references is for arguments, to replace e.g. void foo(int*) with void foo(int&). However, our Holy Standard claims that a reference must be initialized with an _object_, before...
110
by: Vijay Kumar R Zanvar | last post by:
Hi, Which section of C99 says that return value of malloc(3) should not be casted? Thanks. -- Vijay Kumar R Zanvar My Home Page - http://www.geocities.com/vijoeyz/
3
by: subnet | last post by:
I'm trying to write a very simple program that uses a signal-based synchronization between two processes. Here's it: ----------------------------------------------- /* The world's simplest...
2
by: Marco Stauder | last post by:
Hello everybody, I am running linux and built up an old win95 box to play with. Now I try to write my own WinNuker. I red about Out Of Band (OOB) Data which crashes the tiny win95 box. I wrote my...
6
by: Tiraman | last post by:
Hi, if i need to send some data over the net to server what is the best way (http , socket or other ) to do that ? Best Regards , Tiraman :-)
2
by: jamie | last post by:
HELP!!!! Im getting frustrated with trying to draw a simple Xor line on a picture box. I am tring to do it without refreshing the picture box. Isn't there a way? The reason for the hesitation...
1
by: sush | last post by:
Position: SR. S/W ENG. Job Location: BANGALORE Experience; 4 to 7yrs Job Requirements: · Graduate/post graduate degree in Computer science, engineering or technology · 4-7 years of industry...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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...

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.