Solved

GridView Disappears When I do a Sort

Posted on 2006-06-26
1
1,765 Views
Last Modified: 2010-08-05
I have a gridview that disappears when I try to sort by one of the columns.  I can't see if there's a problem in the code.  Everything seems to be ok to me, but that must be wrong since I'm still having this problem.

I just tried to bring up another gridview which was working and sorting fine before, but now that one is having the same problem. When I click on the column header to sort, the grid disappears. Do you know of any issue or property or setting in IE 6 that might cause a scenerio like that.

If it helps, here's the ASP for the gridview and the SqlDataSource.  Let me know if you see anything amiss that I did not notice.

Thank you,
Craig Newman

                        <asp:GridView ID="grdDiarySearch" runat="server" AllowSorting="True" AutoGenerateColumns="False"
                            CellPadding="1" DataSourceID="sdsDiarySearch" GridLines="None" Width="95%" DataKeyNames="DIARY_SEQ_NO">
                            <Columns>
                                <asp:CommandField ShowSelectButton="True" > 
                                    <Itemstyle CssClass="tabStripBodyBorder"/>
                                    <HeaderStyle CssClass="tableBodyHilightFull"/>
                                </asp:CommandField>
                                <asp:BoundField DataField="BROKER_NAME" HeaderText="Broker Name" SortExpression="BROKER_NAME" > 
                                    <Itemstyle CssClass="tabStripBodyBorder" HorizontalAlign=Left/>
                                    <HeaderStyle CssClass="tableBodyHilightFull"/>
                                </asp:BoundField>
                                <asp:BoundField DataField="BC_NAME" HeaderText="Rep/Analyst" SortExpression="BC_NAME" > 
                                    <Itemstyle CssClass="tabStripBodyBorder" HorizontalAlign=Left/>
                                    <HeaderStyle CssClass="tableBodyHilightFull"/>
                                </asp:BoundField>
                                <asp:BoundField DataField="OTHER_CONTACT" HeaderText="Other Analyst" SortExpression="OTHER_CONTACT">
                                    <Itemstyle CssClass="tabStripBodyBorder" HorizontalAlign=Left/>
                                    <HeaderStyle CssClass="tableBodyHilightFull"/>
                                </asp:BoundField>
                                <asp:BoundField DataField="STRATEGY" HeaderText="Prod/Strategy" SortExpression="STRATEGY"  >
                                    <Itemstyle CssClass="tabStripBodyBorder" HorizontalAlign=Left/>
                                    <HeaderStyle CssClass="tableBodyHilightFull"/>
                                </asp:BoundField>
                                <asp:BoundField DataField="INTERACTION" HeaderText="Service" SortExpression="INTERACTION"  >
                                    <Itemstyle CssClass="tabStripBodyBorder" HorizontalAlign=Left/>
                                    <HeaderStyle CssClass="tableBodyHilightFull"/>
                                </asp:BoundField>
                                <asp:BoundField DataField="SECTOR" HeaderText="Sector" SortExpression="SECTOR"  >
                                    <Itemstyle CssClass="tabStripBodyBorder" HorizontalAlign=Left/>
                                    <HeaderStyle CssClass="tableBodyHilightFull"/>
                                </asp:BoundField>
                                <asp:BoundField DataField="REGION" HeaderText="Region" SortExpression="REGION"  >
                                    <Itemstyle CssClass="tabStripBodyBorder" HorizontalAlign=Left/>
                                    <HeaderStyle CssClass="tableBodyHilightFull"/>
                                </asp:BoundField>
                                <asp:BoundField DataField="CATEGORY" HeaderText="Interaction Type" SortExpression="CATEGORY" > 
                                    <Itemstyle CssClass="tabStripBodyBorder" HorizontalAlign=Left/>
                                    <HeaderStyle CssClass="tableBodyHilightFull"/>
                                </asp:BoundField>
                                <asp:BoundField DataField="CONTACT_NAME" HeaderText="Contact" SortExpression="CONTACT_NAME" > 
                                    <Itemstyle CssClass="tabStripBodyBorder" HorizontalAlign=Left/>
                                    <HeaderStyle CssClass="tableBodyHilightFull"/>
                                </asp:BoundField>
                                <asp:BoundField DataField="START_DT" HeaderText="Date" SortExpression="START_DT"  >
                                    <Itemstyle CssClass="tabStripBodyBorder" HorizontalAlign=Left/>
                                    <HeaderStyle CssClass="tableBodyHilightFull"/>
                                </asp:BoundField>
                            </Columns>
                        </asp:GridView>
                        <asp:SqlDataSource ID="sdsDiarySearch" runat="server" ConnectionString="<%$ ConnectionStrings:DSN %>"
                            SelectCommand="SELECT BROKER_NAME, BC.USER_LAST_NAME + ',' + BC.USER_FIRST_NAME AS BC_NAME, CONVERT(varchar(10), [START_DT], 101) AS [START_DT], C.DESCR AS CATEGORY, &#13;&#10;CT.USER_LAST_NAME + ',' + CT.USER_FIRST_NAME AS CONTACT_NAME, S.DESCR AS STRATEGY, SR.DESCR AS SECTOR, R.DESCR AS REGION,&#13;&#10; [OTHER_CONTACT], i.DESCR AS INTERACTION, ID.DIARY_SEQ_NO AS DIARY_SEQ_NO FROM [Interaction_Diary] ID Left outer join&#13;&#10;Broker B on ID.Broker_Seq_No = B.Broker_Seq_no LEFT OUTER JOIN&#13;&#10;USERS BC ON ID.BROKER_CONTACT_SEQ_NO = BC.USER_SEQ_NO LEFT OUTER JOIN&#13;&#10;CATEGORIES C ON ID.CATEGORIES_SEQ_NO = C.CATEGORIES_SEQ_NO LEFT OUTER JOIN&#13;&#10;USERS CT ON ID.USER_SEQ_NO = CT.USER_SEQ_NO LEFT OUTER JOIN&#13;&#10;STRATEGY S ON ID.STRATEGY_SEQ_NO = S.STRATEGY_SEQ_NO LEFT OUTER JOIN&#13;&#10;SECTOR SR ON ID.SECTOR_SEQ_NO = SR.SECTOR_SEQ_NO LEFT OUTER JOIN&#13;&#10;REGION R ON ID.REGION_SEQ_NO = R.REGION_SEQ_NO LEFT OUTER JOIN&#13;&#10;INTERACTION I ON ID.INTERACTION_SEQ_NO = I.INTERACTION_SEQ_NO&#13;&#10;WHERE 1=0">
                        </asp:SqlDataSource>
0
Comment
Question by:robinh583
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 15

Accepted Solution

by:
justinbillig earned 250 total points
ID: 16984515
you have to rebind the data source in the

grdDiarySearch_OnSort event


read this article from 4guysfromrolla.com about the datagrid it should help you ( it is long but worth it )

http://aspnet.4guysfromrolla.com/articles/040502-1.aspx
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question