Hi,
I have an aspx form page the querys a datasource into a datareader. Each data item is then displayed in a textbox control each with a label control to identify it. I have each pair of lable/textbox controls in a planel control.
Often there will be missing data so I need to remove the label and the space on the displayed form when that is the case.
I thought I could do this by removing the panel and the lable and textbox contained in it when the data item that is bound to the textbox is empty. I'm doing something wrong.
This is the line the I am trying
<b><code>
Page.Controls.Remove("plnPhone"
</code></b>
'plnPhone' is the id of the panel control I am trying to remove.
The error message is
<color red>Value of type 'String' cannot be converted to 'System.Web.UI.Control"
</color>
Any help would be much appreciated.
I have an aspx form page the querys a datasource into a datareader. Each data item is then displayed in a textbox control each with a label control to identify it. I have each pair of lable/textbox controls in a planel control.
Often there will be missing data so I need to remove the label and the space on the displayed form when that is the case.
I thought I could do this by removing the panel and the lable and textbox contained in it when the data item that is bound to the textbox is empty. I'm doing something wrong.
This is the line the I am trying
<b><code>
Page.Controls.Remove("plnPhone"
</code></b>
'plnPhone' is the id of the panel control I am trying to remove.
The error message is
<color red>Value of type 'String' cannot be converted to 'System.Web.UI.Control"
</color>
Any help would be much appreciated.