Datagrid Sort/Link Problem

Discussion in 'ASP .Net Datagrid Control' started by rodg12, Jul 20, 2005.

  1. rodg12

    rodg12 Guest

    I designed a data grid for a results page for some product data. The
    specific data put in the data grid is based on criteria entered into an
    initial search page. I have enabled sorting in my data grid and have a
    column of links which access a report on a specific product. However,
    after I click to sort the data or click the link to get the report, I
    can go no farther back using the back button than the results page. Has
    anyone had this problem? I have dealt with setting SmartNav on and off
    on the different pages and this does not fix the problem. Any
    ideas on how to fix this????
    rodg12, Jul 20, 2005
    #1
    1. Advertising

  2. rodg12

    rodg12 Guest

    To add some info:
    I use response.redirects to go to the next page and pass the values
    from the search table using a query string. My data grid has 4
    columns. Three bound columns and one template column that contains the
    link to the report for that specific product. Here is my code for the
    datagrid and the sorteventhandler:

    <p><asp:datagrid id="dgResults" runat="server" HorizontalAlign="Center"
    AlternatingItemStyle-BackColor="WhiteSmoke" AllowSorting="True"
    AutoGenerateColumns="False"
    OnSortCommand="SortEventHandler" width="624px">
    <AlternatingItemStyle
    BackColor="WhiteSmoke"></AlternatingItemStyle>
    <Columns>
    <asp:BoundColumn DataField="FSRNbr" SortExpression="FSRNbr"
    HeaderText="FIX Number"></asp:BoundColumn>
    <asp:BoundColumn DataField="OriginationDate"
    SortExpression="OriginationDate" HeaderText="Origination Date"
    DataFormatString="{0:MM-dd-yyyy}"></asp:BoundColumn>
    <asp:BoundColumn DataField="ReportType"
    SortExpression="ReportType" HeaderText="Report Type"></asp:BoundColumn>
    <asp:TemplateColumn>
    <ItemTemplate>
    <a
    href='report_redirect.aspx?FSRNbr=<%#DataBinder.Eval(Container.DataItem,"FSRNbr")%>&ReportType=<%#DataBinder.Eval(Container.DataItem,
    "ReportType")%>'>
    Get Report
    </a>
    </ItemTemplate>
    </asp:TemplateColumn>
    </Columns>
    </asp:datagrid></p>

    Dim conn As New
    SqlConnection(ConfigurationSettings.AppSettings("FIXDataConn"))
    Dim sortSQL As String
    'Dim strSQL As String = BuildQuery()
    sortSQL = Session("SQLString") & " Order By " &
    e.SortExpression
    Dim com As New SqlCommand(sortSQL, conn)
    conn.Open()
    dgResults.DataSource =
    com.ExecuteReader(CommandBehavior.CloseConnection)
    dgResults.DataBind()

    Really need some help on this guys and gals.
    rodg12, Jul 21, 2005
    #2
    1. Advertising

  3. rodg12

    Elton Wang Guest

    One solution is to open detail (report) page in a new window. So you don't
    need backward. In order to open new window, you just add target = '_blank'
    in <a> tag.

    HTH

    Elton Wang

    "rodg12" <> wrote in message
    news:...
    > To add some info:
    > I use response.redirects to go to the next page and pass the values
    > from the search table using a query string. My data grid has 4
    > columns. Three bound columns and one template column that contains the
    > link to the report for that specific product. Here is my code for the
    > datagrid and the sorteventhandler:
    >
    > <p><asp:datagrid id="dgResults" runat="server" HorizontalAlign="Center"
    > AlternatingItemStyle-BackColor="WhiteSmoke" AllowSorting="True"
    > AutoGenerateColumns="False"
    > OnSortCommand="SortEventHandler" width="624px">
    > <AlternatingItemStyle
    > BackColor="WhiteSmoke"></AlternatingItemStyle>
    > <Columns>
    > <asp:BoundColumn DataField="FSRNbr" SortExpression="FSRNbr"
    > HeaderText="FIX Number"></asp:BoundColumn>
    > <asp:BoundColumn DataField="OriginationDate"
    > SortExpression="OriginationDate" HeaderText="Origination Date"
    > DataFormatString="{0:MM-dd-yyyy}"></asp:BoundColumn>
    > <asp:BoundColumn DataField="ReportType"
    > SortExpression="ReportType" HeaderText="Report Type"></asp:BoundColumn>
    > <asp:TemplateColumn>
    > <ItemTemplate>
    > <a
    >

    href='report_redirect.aspx?FSRNbr=<%#DataBinder.Eval(Container.DataItem,"FSR
    Nbr")%>&ReportType=<%#DataBinder.Eval(Container.DataItem,
    > "ReportType")%>'>
    > Get Report
    > </a>
    > </ItemTemplate>
    > </asp:TemplateColumn>
    > </Columns>
    > </asp:datagrid></p>
    >
    > Dim conn As New
    > SqlConnection(ConfigurationSettings.AppSettings("FIXDataConn"))
    > Dim sortSQL As String
    > 'Dim strSQL As String = BuildQuery()
    > sortSQL = Session("SQLString") & " Order By " &
    > e.SortExpression
    > Dim com As New SqlCommand(sortSQL, conn)
    > conn.Open()
    > dgResults.DataSource =
    > com.ExecuteReader(CommandBehavior.CloseConnection)
    > dgResults.DataBind()
    >
    > Really need some help on this guys and gals.
    >
    Elton Wang, Jul 21, 2005
    #3
  4. rodg12

    rodg12 Guest

    Thanks for the reply Elton. This would solve my problem with the link
    but wouldn't help with with the sort problem. Any idea what I could do
    there??
    rodg12, Jul 21, 2005
    #4
  5. rodg12

    Elton Wang Guest

    I am not sure what problem it is in sorting. Could you make it clearer?


    "rodg12" <> wrote in message
    news:...
    > Thanks for the reply Elton. This would solve my problem with the link
    > but wouldn't help with with the sort problem. Any idea what I could do
    > there??
    >
    Elton Wang, Jul 21, 2005
    #5
  6. rodg12

    rodg12 Guest

    I click on the header row to sort a column and after the page reloads
    with the datagrid sorted, the back button on the browser is disabled.
    I can't go back to the search page, I'm stuck on the results page with
    the data sorted. The crazy thing is that it works just fine in a
    Mozilla browser (back button doesn't get disabled), but does not work
    right in IE (back button disables). It's possible this is just a bug
    with IE, but I'm not sure of that. The page is still listed in my
    history so the history isn't being purged or something like that either.
    rodg12, Jul 21, 2005
    #6
  7. rodg12

    Elton Wang Guest

    I don't think it's IE problem. My IE works fine with Back button (after
    datagrid sorting). And it's first time I heared the problem. Although I'm
    not sure what causes the problem, check your IE settings.
    Elton Wang, Jul 21, 2005
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Raymond Lewallen

    Click on sort link on a datagrid opens new window

    Raymond Lewallen, Apr 29, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    2,065
    George Ter-Saakov
    Apr 30, 2004
  2. Kevin Spencer

    Re: Link Link Link DANGER WILL ROBINSON!!!

    Kevin Spencer, May 17, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    792
    Kevin Spencer
    May 17, 2005
  3. Raymond Lewallen

    Click on sort link on a datagrid opens new window

    Raymond Lewallen, Apr 29, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    3
    Views:
    211
    George Ter-Saakov
    Apr 30, 2004
  4. Burak Gunay
    Replies:
    0
    Views:
    146
    Burak Gunay
    Jan 9, 2006
  5. Navin
    Replies:
    1
    Views:
    667
    Ken Schaefer
    Sep 9, 2003
Loading...

Share This Page