I have a user control that displays a list of categories. In that user control I have a Label control that I would like to write to from the code behind file. This is my Label
I have tried this code:
Label lblCount = (Label)this.Page.FindControl('Label1'); lblCount.text = 'some text';
How can I get access to write to the label from the user control code behind page? What code would I need. I keep getting this error: Object reference not set to an instance of an object.
Any help would be greatly appreciated.
i usually do it like this
then have a method like this in the code behind.
The GetAmount() method will be called for every row in the page. You can pass parameters from the datasoure using Eval(‘ColumnName’) if you need them.