-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: Dhanaventh
Message 2 in Discussion

Hi,  Just check this illustration of paging in a datagrid. This should answer all ur 
issues.RegardsDan 
====================================================================<%@ Import 
Namespace="System.Data" %> <%@ Import Namespace="System.Data.OleDb" %>  <html> <head> 
<title>DataGrid PagerStyle Properties Example</title> <link rel="stylesheet" 
href="/aspxtreme/shared/netdemos.css">  <script language="C#" runat="server" 
src="fetchData_oledb.cs" />  <script language="C#" runat="server">    void Page_Load ( 
Object src, EventArgs e ) {       if ( !IsPostBack ) {          string query = "select 
distinct Type from Plans where not Type=''";          typesSelect.DataSource = 
fetchReader ( query, "Plans" );          typesSelect.DataBind ( );          getPlans ( 
null, null );       }    }        void setPager ( Object src, EventArgs e ) {       
plansGrid.PagerStyle.Mode = ( chkNumbers.Checked ) ?            PagerMode.NumericPages 
: PagerMode.NextPrev;        plansGrid.PagerStyle.Position = ( chkTop.Checked ) ?      
      PagerPosition.Top : PagerPosition.Bottom;        plansGrid.PagerStyle.Visible = 
( !chkHide.Checked );        // fetch and rebind the data.       getPlans ( null, null 
);    }     void resetPage ( Object src, EventArgs e ) {       // reset 
CurrentPageIndex       plansGrid.CurrentPageIndex = 0;       // fetch and rebind the 
data.       getPlans ( null, null );    }     void getPage ( Object src, 
DataGridPageChangedEventArgs e ) {       // set CurrentPageIndex to the page the user 
clicked.       plansGrid.CurrentPageIndex = e.NewPageIndex;       // fetch and rebind 
the data.       getPlans ( null, null );    }     void getPlans ( Object src, 
EventArgs e ) {       string query = "select * from Plans where Type='" +           
typesSelect.SelectedItem + "' order by Design, PlanID";       plansGrid.DataSource = 
fetchData ( query, "plans" );       plansGrid.DataBind ( );        lblTracker.Text = 
"Page " + ( plansGrid.CurrentPageIndex + 1 ) +           " of " + plansGrid.PageCount; 
   } </script> </head>  <body>  <div class="header"><h3>DataGrid PagerStyle Properties 
Example</h3></div>  <hr size=1 width=90%>  <div align="center"> <form runat="server">  
   <table cellpadding=5 width=100%>    <tr style="font-size:8pt">       <td>Plan Type 
<asp:dropdownlist id="typesSelect" runat="server"           datatextfield="Type" 
onSelectedIndexChanged="resetPage" autopostback /></td>       <td><b><asp:label 
id="lblTracker" runat="server" /></b></td>       <td align="right">          
<asp:checkbox id="chkNumbers" runat="server"             title="Mode Property"         
    text="Numeric buttons"             autopostback              
onCheckedChanged="setPager" />          <asp:checkbox id="chkTop" runat="server"       
      title="Position Property"             text="Pager on Top"             
autopostback checked             onCheckedChanged="setPager" />              
<asp:checkbox id="chkHide" runat="server"             title="Visibility Property"      
       text="Hide Pager"             autopostback              
onCheckedChanged="setPager" />       </td></tr>    </table>     <asp:datagrid 
id="plansGrid" runat="server"       width=98% cellpadding=5       font-size="8pt"      
 gridlines="horizontal"       showheader=false       itemstyle-verticalalign="top"     
  autogeneratecolumns=false       allowpaging pagesize=3       
onPageIndexChanged="getPage">        <pagerstyle          nextpagetext="Next" 
prevpagetext="Back"          backcolor="navy" forecolor="lime"          
font-name="comic sans ms" font-size="9pt" font-bold          position="top"          
pagebuttoncount=10          horizontalalign="right" />        <columns>           
<asp:boundcolumn              datafield="Design" />          <asp:boundcolumn          
   datafield="Model" />          <asp:boundcolumn              datafield="Description" 
/>          <asp:boundcolumn              datafield="PlanID"             
itemstyle-horizontalalign="right" />           <asp:templatecolumn>             
<itemtemplate>                <asp:hyperlink runat="server"                   
navigateurl='<%# DataBinder.Eval ( Container.DataItem,                       "PlanID", 
"details_plans.aspx?id={0}" ) %>'                   imageurl='<%# DataBinder.Eval ( 
Container.DataItem,                       "PlanID", 
"~/shared/images/plans/thumbs/{0}.jpg" ) %>'                    tooltip='<%# ( ( 
DataRowView ) Container.DataItem ) [ "Model" ] %>' />             </itemtemplate>      
    </asp:templatecolumn>        </columns>     </asp:datagrid>  </form> </div>   
</body> </html> 
=============================================================================================

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to