Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Datagrid Sort/Link Problem

Reply
Thread Tools

Datagrid Sort/Link Problem

 
 
rodg12
Guest
Posts: n/a
 
      07-20-2005
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????

 
Reply With Quote
 
 
 
 
rodg12
Guest
Posts: n/a
 
      07-21-2005
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.Ev al(Container.DataItem,"FSRNbr")%>&ReportType=<%#Da taBinder.Eval(Container.DataItem,
"ReportType")%>'>
Get Report
</a>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid></p>

Dim conn As New
SqlConnection(ConfigurationSettings.AppSettings("F IXDataConn"))
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.

 
Reply With Quote
 
 
 
 
Elton Wang
Guest
Posts: n/a
 
      07-21-2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> 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.Ev al(Container.DataItem,"FSR
Nbr")%>&ReportType=<%#DataBinder.Eval(Container.Da taItem,
> "ReportType")%>'>
> Get Report
> </a>
> </ItemTemplate>
> </asp:TemplateColumn>
> </Columns>
> </asp:datagrid></p>
>
> Dim conn As New
> SqlConnection(ConfigurationSettings.AppSettings("F IXDataConn"))
> 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.
>



 
Reply With Quote
 
rodg12
Guest
Posts: n/a
 
      07-21-2005
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??

 
Reply With Quote
 
Elton Wang
Guest
Posts: n/a
 
      07-21-2005
I am not sure what problem it is in sorting. Could you make it clearer?


"rodg12" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> 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??
>



 
Reply With Quote
 
rodg12
Guest
Posts: n/a
 
      07-21-2005
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.

 
Reply With Quote
 
Elton Wang
Guest
Posts: n/a
 
      07-21-2005
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.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem in nesting datagrid in to a nested datagrid sajvargs ASP .Net 0 02-20-2005 12:17 AM
problema ultima pagina datagrid asp.net/problem last page datagrid roberto ASP .Net Datagrid Control 1 02-17-2005 07:50 AM
DataGrid edited values problem and autogenerated columns in DataGrid problem John Walsch ASP .Net Web Controls 0 07-09-2004 03:03 PM
Call Datagrid Command column outside datagrid Dave ASP .Net 0 11-20-2003 11:11 AM
To all Gurus: How can I edit/update a DataGrid in a DataGrid (nested DataGrid)? Possible? Andreas Klemt ASP .Net Datagrid Control 0 10-08-2003 01:19 AM



Advertisments