Click here to Skip to main content
15,901,284 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All
We want the count of Hyper link controls of page-1(Which we dont have access to edit the code or view the code) in page-2 or in excel sheet
Posted
Updated 3-Nov-12 22:57pm
v2
Comments
_Amy 31-Oct-12 6:06am    
Your question is not clear. You should improve your question by clicking on "Improve Question" button. And please provide a proper requirement and what you have tried for it also.

I have found all controls of a page and set tabindex, you can try like this...
or please explain your exact requirement


C#
public static void SetTabIndex(ref Panel panelcontainer)
       {
           int tabindex = 1;

            foreach (System.Web.UI.Control ctrl in panelcontainer.Controls)
            {
                if (ctrl.ID != null)
                {
                   
                        if (ctrl is TextBox)
                        {
                            ((TextBox)ctrl).TabIndex = (short)tabindex;
                            tabindex++;
                        }
                        else if (ctrl is Button)
                        {
                            ((Button)ctrl).TabIndex = (short)tabindex;
                            tabindex++;
                        }
                        else if (ctrl is RadioButtonList)
                        {
                            ((RadioButtonList)ctrl).TabIndex = (short)tabindex;
                            tabindex++;
                        }
                        else if (ctrl is ImageButton)
                        {
                            ((ImageButton)ctrl).TabIndex = (short)tabindex;
                            tabindex++;
                        }
                        else if (ctrl is CheckBox)
                        {
                            ((CheckBox)ctrl).TabIndex = (short)tabindex;
                            tabindex++;
                        }
                        else if (ctrl is DropDownList)
                        {
                            ((DropDownList)ctrl).TabIndex = (short)tabindex;
                            tabindex++;
                        }
                        else if (ctrl is HyperLink)
                        {
                            ((HyperLink)ctrl).TabIndex = (short)tabindex;
                            tabindex++;
                        }
                        else if (ctrl is System.Web.UI.HtmlControls.HtmlImage)
                            ((System.Web.UI.HtmlControls.HtmlImage)ctrl).Attributes.Add("tabindex", tabindex.ToString());

                        else if (ctrl is System.Web.UI.HtmlControls.HtmlAnchor)
                            ((System.Web.UI.HtmlControls.HtmlAnchor)ctrl).Attributes.Add("tabindex", tabindex.ToString());
                    
                }
            }
       }
 
Share this answer
 
Comments
sri75vas 31-Oct-12 6:19am    
Hi Soumen
Thanks for the reply.
Actually it gives the count of the controls of the same page. But i want the count of controls of page which i'm not on that page.

Let us consider the below example

Page1:I need the count of controls(O\P:3) of page-2 in Page-1
Page2:Hyper link-1,Hyper Link-2,Hyper Link-3

Thanks in advance
_Amy 31-Oct-12 6:22am    
If page is active then only you can know the count of controls.
sri75vas 31-Oct-12 6:28am    
But i need the count in another page.
_Amy 31-Oct-12 6:31am    
You have only one choice.. Store the controls count of that page in database when that page is active and whenever required, get it from database.
sri75vas 31-Oct-12 6:34am    
Is it possible to store in excel sheet...If possible can you please say how i can store
I believe that this[^] article can help you. It has good sample code for scraping html.
 
Share this answer
 
Comments
sri75vas 2-Nov-12 2:43am    
Hi Markus
Thanks for your reply...
I try with the above code...But it is not showing any error message or any o\p...
Can you please give any suggestions why i'm not getting any thing as an o\p
sri75vas 16-Nov-12 16:13pm    
Please any one help us....

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900