Solved

GridView Disappears When I do a Sort

Posted on 2006-06-26
1
1,780 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

Technology Partners: 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

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

617 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