Re: Can not sort datagrid
- From: Joe <Joe@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 10 Oct 2005 13:18:05 -0700
Jon,
Sorry for the delay. I do create a dataview. Here's the code:
Private Sub PopulateClaimFormsDataGrid(ByVal OrderBy As String, ByVal
SortDirection As String)
'Retrieve Claim Froms data from database
Dim cForm As New ClaimForm
dtClaimForms = cForm.LoadClaimForms(hdnLineOfBusniessID.Value,
hdnSearchText.Value, hdnSelectedCategory.Value, OrderBy, SortDirection)
'If Claim Forms are found, display sorted data
If dtClaimForms.Rows.Count > 0 Then
Dim dvForms As New DataView
dvForms = dtClaimForms.DefaultView
lblFormMsg.Text = String.Empty
dgForms.DataSource = dvForms
dgForms.DataBind()
Else
lblFormMsg.Text = "Can't locate any forms for the provided data."
ClearClaimsFormsDataGrid()
End If
cForm = Nothing
End Sub
This is not the problem. The SortCommand event is never called. So, this
function doesn't matter. The question is, why is the web server not firing
the SortCommand event for the datagrid....
Thanks,
Joe
--
Joe
VBA Automation/VB/C++/Web and DB development
"Jon" wrote:
> We need to see what you do in PopulateClaimFormsDataGrid
>
> You would need to create a DataView and set it Sort property to the
> e.SortExpression param you pass then bind the DataGrid to the DataView
>
>
> "Joe" <Joe@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:7F7B4470-D673-477B-8B6C-8E3921C799A3@xxxxxxxxxxxxxxxx
> > Hello,
> >
> > I have a datagrid in an nested html table (one table inside of another
> > table) and have set the allowsSorting property to true. I've created in
> > the
> > code-behind a method (Sub - I'm using VB.NET) that handles the SortCommand
> > event of the data grid. I've included the declaration of the Sub below.
> > EnableViewState is set to false; we reload the DataSource each time the
> > page
> > posts.
> >
> > Would anyone know why this DataGrid doesn't sort? The web server isn't
> > executing the SortCommand event handler.
> >
> > If tehre is any other information that I can offer, please elt me know.
> > This really has me stumped.
> >
> > Sub Declaration:*********************************
> > Private Sub SortDataGridColumns(ByVal sender As System.Object, ByVal e As
> > System.Web.UI.WebControls.DataGridSortCommandEventArgs) Handles
> > dgForms.SortCommand
> >
> > PopulateClaimFormsDataGrid(e.SortExpression,
> > SwapSortDirection(e.SortExpression))
> > End Sub
> > *********************************************
> >
> > Data Grid HTML**********************************
> > <asp:datagrid id="dgForms" runat="server" CssClass="Interior"
> > AllowSorting="True" AutoGenerateColumns="False">
> > <AlternatingItemStyle
> > BackColor="GhostWhite"></AlternatingItemStyle> <ItemStyle
> > BackColor="Gainsboro"></ItemStyle>
> > <Columns>
> > <asp:HyperLinkColumn Target="_self"
> > DataNavigateUrlField="Form_Path_File_NM" DataTextField="Form_Number"
> > SortExpression="Form_Number" HeaderText="NUMBER">
> > <HeaderStyle Width="10%" CssClass="TableHeader"></HeaderStyle>
> > <ItemStyle CssClass="TableData"></ItemStyle>
> > </asp:HyperLinkColumn>
> > <asp:BoundColumn DataField="Form_Name" SortExpression="Form_Name"
> > HeaderText="NAME">
> > <HeaderStyle Width="50%" CssClass="TableHeader"></HeaderStyle>
> > <ItemStyle CssClass="TableData"></ItemStyle>
> > </asp:BoundColumn>
> > <asp:BoundColumn DataField="Description"
> > SortExpression="Description" HeaderText="CATEGORY">
> > <HeaderStyle Width="25%" CssClass="TableHeader"></HeaderStyle>
> > <ItemStyle CssClass="TableData"></ItemStyle>
> > </asp:BoundColumn>
> > <asp:BoundColumn DataField="Form_State_CD"
> > SortExpression="Form_State_CD" HeaderText="STATE">
> > <HeaderStyle Width="15%" CssClass="TableHeader"></HeaderStyle>
> > <ItemStyle CssClass="TableData"></ItemStyle>
> > </asp:BoundColumn>
> > </Columns>
> > </asp:datagrid>
> > *********************************************
> >
> > TIA,
> >
> > --
> > Joe
> >
> > VBA Automation/VB 6/C++/C#/ VB.NET/Web and DB development
>
>
>
.
- References:
- Can not sort datagrid
- From: Joe
- Can not sort datagrid
- Prev by Date: Re: SqlDataSource - strange error (to me at least) ;-)
- Next by Date: Re: Asp.Net 2.0 Multiple Application Solutions
- Previous by thread: Can not sort datagrid
- Next by thread: Re: Can not sort datagrid
- Index(es):
Relevant Pages
|