需要页面的超级链接数 [英] Required the count of hyper links of a page

查看:78
本文介绍了需要页面的超级链接数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有
我们需要第2页或excel工作表中第1页的超链接控件(我们无权编辑代码或查看代码)的计数.

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

推荐答案

我已经找到了页面的所有控件并设置了tabindex,您可以像这样尝试...
或请解释您的确切要求


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


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());
                    
                }
            }
       }


我相信 [
I believe that this[^] article can help you. It has good sample code for scraping html.


这篇关于需要页面的超级链接数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆