Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Location of paging in a Datagrid

Status
Not open for further replies.

KevoMee

Technical User
Apr 30, 2002
72
IE
Hi all,

I have a grid that begins with 1 column (hyperlink) at design time and has autogenerate set to true. I want the paging be on the top right of the grid, but it seems to get it all wrong. The paging is on the top, but it's not on the far right, but just above where the first column is (Where it would be at design time i.e. on the top right of the first column and it looks pretty shitty).

I've tried setting this at runtime but to no avail. Any ideas??

Cheers.
 
ca8msm,

Don't know if I missed something but I know how to set the position. I'm setting the position successfully but it's not appearing correctly.

I add 1 column at design time and the rest come from the datasource. I have the PagerPostion set to top right but it is only at top right of first column (The column that is set up at design time) rather than top right of the grid.

You know what I mean?
 
Yes, I understand. Can you post the relevant code for the DataGrid (both the HTML and any binding code)?


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Here is the HTML for the grid:

<asp:datagrid id="dgRequests"
runat="server" Height="10px" Width="100%" AllowCustomPaging="True" PageSize="15"
GridLines="Vertical" ForeColor="Black" CellPadding="4" BackColor="White" BorderWidth="1px"
BorderStyle="None" BorderColor="#DEDFDE" AllowSorting="True" AllowPaging="True" PagerStyle-HorizontalAlign="Right"
PagerStyle-Position="Top" OnPageIndexChanged="dgRequests_PageIndexChanged">
<FooterStyle BackColor="#CCCC99"></FooterStyle>
<SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#CE5D5A"></SelectedItemStyle>
<AlternatingItemStyle BackColor="White"></AlternatingItemStyle>
<ItemStyle BackColor="#F7F7DE"></ItemStyle>
<HeaderStyle Font-Bold="True" ForeColor="White" BackColor="#6B696B"></HeaderStyle>
<PagerStyle NextPageText="&amp;nbsp;Next&amp;nbsp;&amp;gt;" PrevPageText="&amp;lt;&amp;nbsp;Prev&amp;nbsp;"
HorizontalAlign="Right" ForeColor="Black" Position="Top" BackColor="#F7F7DE" PageButtonCount="1" Wrap="True" Width="100%"></PagerStyle>
<Columns>
<asp:HyperLinkColumn DataNavigateUrlField="Reference" DataNavigateUrlFormatString="request.aspx?reqID={0}"
Text="Open"></asp:HyperLinkColumn>
</Columns>
</asp:datagrid>

Code for Databinding is fairly plain:

sql = "select count(*) from ( " + _sql + " ) "
_dgGrid.VirtualItemCount = Convert.ToInt32(DB.ExecuteScalar(sql,_sqlParams));

OracleDataReader reader = DB.ExecuteReader(sql, newParams);
try
{
_dgGrid.DataSource = reader;
_dgGrid.DataBind();
}
finally
{
reader.Close();
}


It's custom paging so I've set the virtual item count.

Just a custom reader I have that deals with Paramaters passed. The sql is also modified to only return the amount of records that fit on a page of the datagrid (15 in this case).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top