am sure that the answer to this is quite simple, but I am just not seeing it:
I have a number of text controls on a web page; for example:
I am using a master page and Contentholder to construct my page.
I have been advised to try:
"NullReferenceException was unhandled by user code"
"Object Reference not set to an instance of an object"
It doesnt seem to be finding the Control, even though the static reference to it resolves without problem.
I believe that I may be in the wrong "Control space" but am unsure of how to proceed.
Any help to what I am sure is a simple but frustrating problem would be much appreciated.
Cheers
Thanks in advance,
Steve Lewy
Solutions Developer
SimplyData
simplydata.com.au
(dont cut corners or you'll go round in circles)
I have a number of text controls on a web page; for example:
Whilst I can happily reference these individually; for example:<asp:TextBox ID="ETAC1" runat="server"></asp:TextBox>
<asp:TextBox ID="ETAC2" runat="server"></asp:TextBox>
<asp:TextBox ID="ETAC3" runat="server"></asp:TextBox>
<asp:TextBox ID="ETAC4" runat="server"></asp:TextBox>
I have not been able to figure how I can reference these controls programmatically. For example, I would like to do something like:ETAC1.Text = 10
ETAC2.Text = 20
ETAC3.Text = 30
ETAC4.Text = 40
For i = 1 to 4
thisControlId = "ETAC" & i
Controls(ThisControlId).Text = i*10 ' <-----------
Next
I am using a master page and Contentholder to construct my page.
I have been advised to try:
This however resulted in the error:cn="ETAC1"
ctype(me.findcontrol(cn),textbox).text=10*i
"NullReferenceException was unhandled by user code"
"Object Reference not set to an instance of an object"
It doesnt seem to be finding the Control, even though the static reference to it resolves without problem.
I believe that I may be in the wrong "Control space" but am unsure of how to proceed.
Any help to what I am sure is a simple but frustrating problem would be much appreciated.
Cheers
Thanks in advance,
Steve Lewy
Solutions Developer
SimplyData
simplydata.com.au
(dont cut corners or you'll go round in circles)