Solved

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

Posted on 2006-11-14
4
1,047 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

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

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…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

759 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