Solved

GridView Disappears When I do a Sort

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Name space syntax error 12 44
Anyway to make "All" the default in the dropdown? 6 34
Connection String 16 43
Reset asp.net login password 4 34
Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

863 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now