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

New Message on BDOTNET

-----------------------------------------------------------
From: pawanns
Message 3 in Discussion

hi mottu,


use a static variable to count number of rows...............

one way is checking table count and disabling allowpaging property to 
false........

this another procedure................

hope this solves ur problem..................

static int itemcount;
private void DataGrid1_ItemCreated(object sender, 
System.Web.UI.WebControls.DataGridItemEventArgs e)
                {

                        DataGridItem item = e.Item;
                        if(item.ItemType==ListItemType.Item || 
item.ItemType==ListItemType.AlternatingItem)
                        {
                                itemcount++;
                        }

                if(item.ItemType!=ListItemType.Pager) return;

                                TableCell pager = (TableCell)item.Controls[0];//pager 
is tr; 
pager.control[0] is a td in which page nos are populated
                                System.Diagnostics.Debug.Write(pager.Text);
                                for (int i = 0; i < pager.Controls.Count; i ++)//loop 
thru all the 
elements in pager
                                {
                                        Control pagerItem = pager.Controls[i];
                                        
System.Diagnostics.Debug.Write(pager.Controls[i].GetType().ToString());
                                        //Note: every odd item is an &nbsp; ;even 
items hold page nos ..... 
current page no is a label and other are link buttons

                                        if(itemcount>1)
                                        {
                                                if(i%2!=0)

                                                {

                                                        LiteralControl spacer = 
pagerItem as LiteralControl;

                                                        spacer.Text += "<span 
style='color: #cccccc'>|</span>&nbsp;";

                                                        continue;

                                                }
                                        }
                                                if (pagerItem is LinkButton)

                                                {
                                                        LinkButton btnOtherPageNo = 
(LinkButton)pagerItem;
                                                        if(itemcount==0) 
btnOtherPageNo.Text="";
                                                        if(btnOtherPageNo.Text=="&lt;")
                                                                
btnOtherPageNo.ToolTip="Prev";
                                                        else 
if(btnOtherPageNo.Text=="&gt;")
                                                                
btnOtherPageNo.ToolTip="Next";
                                                        
btnOtherPageNo.ForeColor=Color.CornflowerBlue;
                                                        
btnOtherPageNo.Style["TEXT-DECORATION"]="none";

                                                }

                                        else

                                        {

                                                Label curPageNo = pagerItem as Label;
                                                        if (curPageNo!=null)
                                                        {
                                                                if(itemcount==0) 
curPageNo.Text ="";
                                                                
if(curPageNo.Text=="&lt;")
                                                                        
curPageNo.ToolTip="Prev";
                                                                else 
if(curPageNo.Text=="&gt;")
                                                                        
curPageNo.ToolTip="Next";
                                                                
curPageNo.ForeColor=Color.Crimson;
                                                        }

                                        }

                                }



                }



>From: "Bhuvaneshwararaj" <[EMAIL PROTECTED]>
>Reply-To: "BDOTNET" <[EMAIL PROTECTED]>
>To: "BDOTNET" <[EMAIL PROTECTED]>
>Subject: How to hide the next and previous link button on the datagrid
>Date: Wed, 25 Feb 2004 22:30:18 -0800
>

_________________________________________________________________
INDIA TODAY @ Rs. 5 for 5 years ! 
http://www.indiatoday.com/itoday/intlsubscription/itsubs/it_offer.html 
Subcribe Now ...


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

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