Solved

Gridview with paging disappears when you select the next page?!?!?

Posted on 2006-11-14
4
1,071 Views
Last Modified: 2009-12-16
I have a gridview in my asp.net 2.0 application:  (details below):

the gridvidew is populated by a datasource.
Paging is enabled.
When the page is loaded, it appears without any trouble.  then when i try to select page 2, 3 or 4 etc, the gridview disappears!!!!!!
any help would be much appreciated? I can't figure out why this is happening?!?!?
I have no code behind the gridview........
PLEASE HELP :-)

here are the details of the gridview......

     <asp:GridView ID="GridView1" runat="server" AllowPaging="True" CellPadding="4" DataSourceID="SqlDataSource1"
                        ForeColor="#333333" GridLines="None" Height="55px" PageSize="6" Style="z-index: 114;
                        left: 233px; position: absolute; top: 298px" Visible="True" Width="756px">
                        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                        <EditRowStyle BackColor="#999999" />
                        <Columns>
                            <asp:CommandField ShowSelectButton="True" />
                        </Columns>
                        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                    </asp:GridView>
0
Comment
Question by:ciara_barry123
  • 2
  • 2
4 Comments
 
LVL 6

Assisted Solution

by:badalpatel
badalpatel earned 500 total points
ID: 17937278
i cant figure out whats happening coz this code works fine for me..
i think this must be in ur page load event where u r making gridview visible property to false...
can u post ur page load event code??
0
 

Author Comment

by:ciara_barry123
ID: 17937287
  Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        ShowCalendar(ImageButton9, TextBox1)
        ShowCalendar(ImageButton10, TextBox2)
        If FirstTimeLoad <> False Then
            Me.CategoryList.Items.Insert(0, New ListItem("ALL", "ALL"))
            Me.CategoryList.SelectedIndex = 0
            FirstTimeLoad = False
        End If
    End Sub

so..nothnig in there to do with the gridview
the showcalendar function has nothing to do with it....

I'm stumped!
0
 
LVL 6

Accepted Solution

by:
badalpatel earned 500 total points
ID: 17937307
<form id="form1" method="post" runat="server">
     <asp:GridView ID="GridView1" runat="server" AllowPaging="True" CellPadding="4" DataSourceID="SqlDataSource1"
                        ForeColor="#333333" GridLines="None" Height="55px" PageSize="6" Style="z-index: 114;
                        left: 233px; position: absolute; top: 298px" Visible="True" Width="756px">
                        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                        <EditRowStyle BackColor="#999999" />
                        <Columns>
                            <asp:CommandField ShowSelectButton="True" />
                        </Columns>
                        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                    </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:AIM_finalConnectionString %>"
            SelectCommand="SELECT [Trigger_RecID], [TriggerID], [TriggerName], [TriggerTime], [LocationID], [Value], [ParameterID] FROM [CHALMETTE_TRIGGER_RECORD]">
        </asp:SqlDataSource>
    </form>

i have this code and its works fine on my pc..so what to do next?check the sqldatasource.
0
 

Author Comment

by:ciara_barry123
ID: 17939472
Hi badalpatel
I figured it out
the query to populate the sqldatasource was generated when a button was pressed.
i built up a string and set the string as the selectcommand of the sqldatasource.
it was a global variable.
so when paging was disabled it all worked fine as the page wasn't reloaded
when I enabled paging  - when the gridview was clicked, the global variable became empty and thus the gridview was invisible

I will have to use session variables instead of a global variable and it should all work fine..
thanks for the help
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
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…

860 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