Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2006-11-14
4
Medium Priority
?
1,101 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
[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
  • 2
  • 2
4 Comments
 
LVL 6

Assisted Solution

by:badalpatel
badalpatel earned 1500 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 1500 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
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 …
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

636 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