Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1795
  • Last Modified:

GridView Disappears When I do a Sort

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
robinh583
Asked:
robinh583
1 Solution
 
justinbilligCommented:
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now