System.Web.UI.Page.FindControl C# (CSharp) Метод

FindControl() публичный Метод

public FindControl ( string id ) : Control
id string
Результат Control
	public override Control FindControl (string id) {
		if (id == ID)
			return this;
		else
			return base.FindControl (id);
	}

Same methods

Page::FindControl ( string id, bool decode ) : Control

Usage Example

        private static void ComputerMove()
        {
            Random rand = new Random();
            int positionIndex = rand.Next(0, freePositions.Count);
            Position position = freePositions[positionIndex];
            int row = position.X;
            int col = position.Y;

            if (game[row, col] == '*')
            {
                game[row, col] = computerCharacter;
                freePositions.Remove(position);
                Button btn = new Button();
                Page page = new Page();
                if (HttpContext.Current != null)
                {
                    page = (Page)HttpContext.Current.Handler;
                    btn = (Button)page.FindControl("Btn" + row + col);
                    btn.Text = computerCharacter.ToString();
                }
                if (Win(computerCharacter))
                {
                    Label lbWinner = (Label)page.FindControl("Winner");
                    lbWinner.Text = "You win!";
                    lbWinner.Visible = true;
                    computerScores++;
                    UpdateScores(page);
                    return;
                }
            }
            else
            {
                ComputerMove();
            }
        }
All Usage Examples Of System.Web.UI.Page::FindControl
Page