Solved

GridView Disappears When I do a Sort

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

705 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

17 Experts available now in Live!

Get 1:1 Help Now