M
mister-Ed
I have an admin style datagrid wherre I'm trying to invoke Sort
feature on all the columns, but when using the following components (a
page level strSQL so the bindMyGrid sub can read it, the sub to Sort
the columns, and the datagrid attributes), i do not get the link on
the column names on the datagrid:
'the pagelevel strSQL call
Protected strSQL As String = "SELECT cardid,cat,bname,size,bfile,url
FROM cardbanners"
'binding the datagrid with all the pertinent objects
Sub bindMyGrid()
Dim objConnection As New SQLConnection(strConnection)
Dim objAdapter As New SQLDataAdapter(strSQL,
objConnection)
Dim objDataSet As New DataSet()
objAdapter.Fill(objDataSet, "cardbanners")
Dim objDataView As New
DataView(objDataSet.Tables("cardbanners"))
MyGrid.DataSource = objDataView
MyGrid.DataBind()
End Sub
'sort command call , with a label object tied to the strSQL
Sub SortCommand_OnClick(Source As Object, E As
DataGridSortCommandEventArgs)
SQLStatement.Text = strSQL & " ORDER BY " & E.SortExpression
bindMyGrid()
End Sub
'datagrid stuff on the body of the form
<div style="OVERFLOW: auto; WIDTH: 800px; HEIGHT: 600px"
runat="server">
<asp:Label id="SQLStatement" runat="server" Visible="False" />
<asp:datagrid id="MyGrid" runat="server"
Font-Name="Tahoma" CellPadding="1" Cellspacing="1" border="0"
BackColor="#BC9DD2"
Font-Size="8pt"
OnItemDataBound="MyGrid_ItemDataBound"
OnEditCommand="MyGrid_Edit"
OnDeleteCommand="MyGrid_Delete"
OnUpdateCommand="MyGrid_Update"
OnCancelCommand="MyGrid_Cancel"
AutoGenerateColumns="False"
ShowFooter="True"
OnItemCommand="MyGrid_Insert" width="100%"
AllowSorting="True"
OnSortCommand="SortCommand_OnClick">
TIA
Ed
feature on all the columns, but when using the following components (a
page level strSQL so the bindMyGrid sub can read it, the sub to Sort
the columns, and the datagrid attributes), i do not get the link on
the column names on the datagrid:
'the pagelevel strSQL call
Protected strSQL As String = "SELECT cardid,cat,bname,size,bfile,url
FROM cardbanners"
'binding the datagrid with all the pertinent objects
Sub bindMyGrid()
Dim objConnection As New SQLConnection(strConnection)
Dim objAdapter As New SQLDataAdapter(strSQL,
objConnection)
Dim objDataSet As New DataSet()
objAdapter.Fill(objDataSet, "cardbanners")
Dim objDataView As New
DataView(objDataSet.Tables("cardbanners"))
MyGrid.DataSource = objDataView
MyGrid.DataBind()
End Sub
'sort command call , with a label object tied to the strSQL
Sub SortCommand_OnClick(Source As Object, E As
DataGridSortCommandEventArgs)
SQLStatement.Text = strSQL & " ORDER BY " & E.SortExpression
bindMyGrid()
End Sub
'datagrid stuff on the body of the form
<div style="OVERFLOW: auto; WIDTH: 800px; HEIGHT: 600px"
runat="server">
<asp:Label id="SQLStatement" runat="server" Visible="False" />
<asp:datagrid id="MyGrid" runat="server"
Font-Name="Tahoma" CellPadding="1" Cellspacing="1" border="0"
BackColor="#BC9DD2"
Font-Size="8pt"
OnItemDataBound="MyGrid_ItemDataBound"
OnEditCommand="MyGrid_Edit"
OnDeleteCommand="MyGrid_Delete"
OnUpdateCommand="MyGrid_Update"
OnCancelCommand="MyGrid_Cancel"
AutoGenerateColumns="False"
ShowFooter="True"
OnItemCommand="MyGrid_Insert" width="100%"
AllowSorting="True"
OnSortCommand="SortCommand_OnClick">
TIA
Ed