Asp.Net: passing a value from a page to a UserControl

I have a text box on my aspx page and I need the usercontrol to be able to see or access this value, as I would.

I created a public property on my aspx page

public string txtBoolValue
    {
        get { return this.txtBool.Text;}
    }

How do I call this on my ascx page?

thank

melt

+3
source share
3 answers

, , . , , .

+13

Try the following:

((Textbox)this.Parent.FindControl("YOUR TEXTBOX NAME IN ASPX PAGE")).Text
+2
source

Source: https://habr.com/ru/post/1725943/