S
samir dsf
hi
i am using a caluculated column to sort the datagrid; when i form the
query it takes that new column and hence gives me an error 'Invalid
column name'.
here is what i am doing:
in my ascx page:
<asp:TemplateColumn HeaderText="Last Modified"
HeaderStyle-CssClass="SubHead" SortExpression="lbl2">
<ItemTemplate>
<asp:Label Runat="server" ID="lblMdDate" CssClass="SubHead"></asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
in dgFiles_ItemDataBound i am calculatating the column value
Dim lastmodifeddt As Date = File.GetLastWriteTime(FilePath & filename)
lastmodifeddt = lastmodifeddt.Date
lbl.Text = fileBytes.ToString
lbl2.Text = lastmodifeddt
so lastmodifeddt is my calulated value which i can see in the datagrid
here is my bindgrid function
GoToDBOpenConn()
myDa.SelectCommand = New System.Data.OleDb.OleDbCommand(strSQL,
objConnection)
myDa.Fill(myDS)
myDS.Tables(0).Columns.Add("lastmodifeddt")
Dim objView As New DataView(myDS.Tables(0))
objView.Sort = "lastmodifeddt ASC"
dgFiles.DataSource = objView
dgFiles.DataBind()
and here is my sort funtion:
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)='rty') and FILEREPORT='REPORT' ORDER BY " &
E.SortExpression()
bindGrid2()
End Sub
can anyone help me what i m missing. their is something wrong i am doing
... but not able to make out. would be really grateful if somebody could
help me on this.
thanks a lot
i am using a caluculated column to sort the datagrid; when i form the
query it takes that new column and hence gives me an error 'Invalid
column name'.
here is what i am doing:
in my ascx page:
<asp:TemplateColumn HeaderText="Last Modified"
HeaderStyle-CssClass="SubHead" SortExpression="lbl2">
<ItemTemplate>
<asp:Label Runat="server" ID="lblMdDate" CssClass="SubHead"></asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
in dgFiles_ItemDataBound i am calculatating the column value
Dim lastmodifeddt As Date = File.GetLastWriteTime(FilePath & filename)
lastmodifeddt = lastmodifeddt.Date
lbl.Text = fileBytes.ToString
lbl2.Text = lastmodifeddt
so lastmodifeddt is my calulated value which i can see in the datagrid
here is my bindgrid function
GoToDBOpenConn()
myDa.SelectCommand = New System.Data.OleDb.OleDbCommand(strSQL,
objConnection)
myDa.Fill(myDS)
myDS.Tables(0).Columns.Add("lastmodifeddt")
Dim objView As New DataView(myDS.Tables(0))
objView.Sort = "lastmodifeddt ASC"
dgFiles.DataSource = objView
dgFiles.DataBind()
and here is my sort funtion:
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)='rty') and FILEREPORT='REPORT' ORDER BY " &
E.SortExpression()
bindGrid2()
End Sub
can anyone help me what i m missing. their is something wrong i am doing
... but not able to make out. would be really grateful if somebody could
help me on this.
thanks a lot