ASP.NET: Pass value from User Control to page?

后端 未结 3 1500
温柔的废话
温柔的废话 2021-01-13 13:34

I am creating a user control in ASP.NET (using VB) that uses the autocomplete ajax control on a textbox to get a value. Then I want the page to post back and run some code

3条回答
  •  猫巷女王i
    2021-01-13 13:55

    In your user control expose a property for the value

    Public Property SomeValue() As String
    Get
        Return textbox1.Text
    End Get
    End Property
    

    Then in your aspx page load, just reference the user control's value.

    userControl1.SomeValue
    

    Edit, I just tried changing my syntax to vb.net, I don't actually know vb, so that syntax may or may not be right.

提交回复
热议问题