There are test.aspx page and test.ascx web user control.
I have a button in test.aspx = btn_test and above code in my button is :
Dim ct As Control = Page.LoadControl("test.ascx")
Panel1.Controls.Add(ct)
There is a dropdownlist with value 1 to 10 in test.aspx and there is label_test in test.ascx
I need some code when test.ascx loading, get dropdownlist.selectedvalue and show it in label_test.
Please help me !
There are a number of ways to implement this. One you could try would be to cast the test.ascx web control being loaded like so (replace TestControl with the class name for the control):
And then create a public property in the control which you would use to set the value from the DropDownList.
This property would then be used to set the labels value (either directly using the set accessor or via a method within the test.ascx control).