jscript document.getElementsByName in C#

本文关键字:in getElementsByName document jscript | 更新日期: 2023-09-27 17:57:37

哪个在c#中相似?

var e = document.getElementsByName("test")[0];
var HTML = e.innerHTML; 

jscript document.getElementsByName in C#

递归FindControl方法:

    private Control RecursiveControlFind(Control parent, string controlID)
    {
        Control child = parent.FindControl(controlID);
        if (child == null)
        {
            if (parent.Controls.Count > 0)
            {
                foreach (Control nestedControl in parent.Controls)
                {
                    child = RecursiveControlFind(nestedControl, controlID);
                    if (child != null)
                        break;
                }
            }
        }
        return child;
    }

Control.FindControl方法,但它不是递归的。