get value from usercontrol
-
Hi, I have placed a usercontrol inside a .aspx page. The usercontrol has a label control called label1. Question: In the webform.cs, how do I get the value of the label control in the usercontrol? Thanks
You just use the following code Dim str as String str=ctype(usercontrolname.findcontrol("lable1"),lable).Text
-
Hi, I have placed a usercontrol inside a .aspx page. The usercontrol has a label control called label1. Question: In the webform.cs, how do I get the value of the label control in the usercontrol? Thanks
Create a property in user control & access its value in .aspx page. in User control,
public string TextValue
{
get{ return label1.Text; }
}On .aspx page, you can get the label text as: string labelText = Userconrol1.TextValue;
-
Hi, I have placed a usercontrol inside a .aspx page. The usercontrol has a label control called label1. Question: In the webform.cs, how do I get the value of the label control in the usercontrol? Thanks
-
I do not seem to be able to access the usercontrol from the .aspx cs file. Note that the usercontrol1 is inside a folder called usercontrols. Any thoughts please? Thanks
Did you register the user control on the aspx page?If not First register it on your aspx page. else just go to design view of your aspx page and drag the usercontrol on your page it automatically register the control.Then you will be able to access the control from your aspx page.
Cheers!! Brij
-
Did you register the user control on the aspx page?If not First register it on your aspx page. else just go to design view of your aspx page and drag the usercontrol on your page it automatically register the control.Then you will be able to access the control from your aspx page.
Cheers!! Brij