-
Oct 30th, 2012, 08:56 AM
#1
Thread Starter
New Member
Gridview page numers not displaying
I have a page with a couple of grids on it, one displays a list of results from a search and the other then displays details when one of the result rows is selected.
Even though the second grid has multiple pages the page numbers are not diplaying at runtime (they can be seen in design mode) so I can't page through the information. The paging is all fine on the results grid and the properties appear the same for both grids.
Any help would be greatly appreciated
-
Oct 30th, 2012, 09:30 PM
#2
Re: Gridview page numers not displaying
Without markup and code info, we cannot help.A quick thought thought. If your second grid display details from the selected row on the first, is it possible that the second grid has not reached the page max provided, to go to a new page?I mean pagesize variable, if i am not mistaken.
ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·
-
Oct 31st, 2012, 03:32 AM
#3
Thread Starter
New Member
Re: Gridview page numers not displaying
Hi,
If I look at the gridview pagecount it's multiple, it's just not displaying the page numbers at the bottom like it should be. The results hrid lists properties and then the second grid lists electors within the selected property which might only be one or two but in the case of care homes can be upwards of 30, my page size is only 5.
This is the markup for my results grid
<asp:Panel runat="server" ID="wpResults" BorderColor="#3A9946" BorderStyle="Solid"
BorderWidth="1px" Width="98%" Visible="false">
<asp:GridView ID="gvResults" runat="server" Width="98%" AutoGenerateColumns="False"
AllowPaging="True" GridLines="None" ShowHeader="false" DataKeyNames="ID">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Image ID="imgRow" runat="server"></asp:Image>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Type" />
<asp:BoundField DataField="ID" />
<asp:BoundField DataField="ElectorName" />
<asp:BoundField DataField="Ref" />
<asp:BoundField DataField="Address" />
</Columns>
<PagerStyle BorderStyle="None" Font-Names="Trebuchet MS" Font-Size="X-Small" ForeColor="#3A9946"
HorizontalAlign="Center" />
<RowStyle BackColor="#E3F1E5" />
<AlternatingRowStyle BackColor="#84CA98" />
<SelectedRowStyle Font-Size="Small" />
</asp:GridView>
<br />
</asp:Panel>
And this is the markup for the Electors grid
<asp:Panel runat="server" ID="wpPropertyElectors" BorderColor="#3A9946" BorderStyle="Solid"
BorderWidth="1px" Width="98%" Visible="false" >
<asp:GridView ID="gvElectors" runat="server" Width="98%" AutoGenerateColumns="False" ShowHeader="false"
AllowPaging="True" GridLines="None" DataKeyNames="ID" PageSize="5" >
<Columns>
<asp:BoundField DataField="ID" ItemStyle-Width="3%" >
<ItemStyle Width="3%" />
</asp:BoundField>
<asp:BoundField DataField="Elector" ItemStyle-Width="50%" >
<ItemStyle Width="50%" />
</asp:BoundField>
<asp:BoundField DataField="Number" ItemStyle-Width="15%" >
<ItemStyle Width="15%" />
</asp:BoundField>
<asp:BoundField DataField="Markers" ItemStyle-Width="15%" >
<ItemStyle Width="15%" />
</asp:BoundField>
<asp:BoundField DataField="Status" ItemStyle-Width="20%" >
<ItemStyle Width="20%" />
</asp:BoundField>
</Columns>
<PagerStyle BorderStyle="None" Font-Names="Trebuchet MS" Font-Size="Large" ForeColor="#3A9946"
HorizontalAlign="Center" />
<RowStyle BackColor="#E3F1E5" />
<AlternatingRowStyle BackColor="#84CA98" />
<SelectedRowStyle Font-Size="Small" />
</asp:GridView>
<br />
</asp:Panel>
-
Oct 31st, 2012, 08:38 PM
#4
Re: Gridview page numers not displaying
Hi.So if you have more than 5 rows what happens to the gridview?Do you see and extra 6th row on the same page or it's not displayed at all?Can you show the vb code when you bind your data?
Also try removing the panel, for a quick test.
ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·
-
Nov 1st, 2012, 03:54 AM
#5
Thread Starter
New Member
Re: Gridview page numbers not displaying
Even without the panel its the same, doesn't matter how many records are returned from the database it only shows the first 5. If I break after the bind and check the number of pages in the gridview it has multiple but the page numbers are not displaying on screen so I can't page through.
Private Sub BindElectors()
Try
gvElectors.Visible = True
gvElectors.DataSource = PropertyElectors
gvElectors.DataBind()
Catch ex As Exception
Throw
End Try
End Sub
PropertyElectors is a DataTable
-
Nov 1st, 2012, 08:52 PM
#6
Re: Gridview page numers not displaying
Hi.At first leave the gridview visible on markup and remove the visible=true from code.Also you should check your dataset rows to confirm that they are more than 5.If they are then trry setting the gridview alone with the absolute minimum:
Code:
<asp:GridView ID="gvResults" runat="server" AutoGenerateColumns="False"
AllowPaging="True" DataKeyNames="ID"/>
If again nothing then create a new page and do a databind on a new gridview with your datatable to see if it works in the first place.
Ah, also remove the paging option as a test to make sure that they data comes over 5 rows.
Also if there is any jscript of other code you haven't shown and effects the gridview, do so.
ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·
-
Nov 2nd, 2012, 03:58 AM
#7
Thread Starter
New Member
Re: Gridview page numbers not displaying
Not being a complete novice I have tried the obvious suggestions you have proposed and am looking for something a bit less obvious that I may have missed.
I know my datatable has 20+ rows, I know my gridview has 6+ pages as I put a breakpoint in the code to check. There is no jscript affecting the gridview it is just a simple display for selection. As I said previously I have another grid that is set the same and works fine so it is very puzzling.
-
Nov 2nd, 2012, 07:54 PM
#8
Re: Gridview page numers not displaying
Ok, then make a new page and use only the problematic gridview.As soon as you see that it works then bring along the first gridview.
ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·
-
Nov 5th, 2012, 06:19 AM
#9
Thread Starter
New Member
Re: Gridview page numbers not displaying
I did as you advised and the new page shows the page numbers. I then removed everything from the original page except the search and results functionality and I've attached a screenshot of the results but essentially the grid on the same page shows oPaging.docRegisterDetails.zipnly 5 results but the new page shows the same 5 records and page numbers!
I've attached the new code files as well, hopefully that will help you see what I've missed
-
Nov 5th, 2012, 07:41 PM
#10
Re: Gridview page numers not displaying
Sorry, can't look all the code for you, you have to do it yourself.Anyhow with just a quick look i see that you set the grid pagesize in markup and then you have a function in code that set's the pagesize according to height. What is the correct?
Also did you write this code by yourself?Do you know what it does,exactly?
ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·
-
Nov 6th, 2012, 03:35 AM
#11
Thread Starter
New Member
Re: Gridview page numers not displaying
If you'd looked at the code properly you would've have seen that the page size set routine is for the results gridview not the electors one! Of course I wrote it myself and know exactly what it does...I sent the code in the hope that you would help me not patronise and be rude to me. If you don't know then you don't know...just admit it and move on.
-
Nov 6th, 2012, 06:47 PM
#12
Re: Gridview page numers not displaying
Huh?When was i rude?I explained that you can't just shoot 2000 code lines and expect me to read it.You have to pinpoint the problem.Anyhow, i admit that i don't know and i move on.
ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|