I have say cMyControl as Control.
I want to set cMyControl = sTemp
I can't seem to find the right way to convert the string.
Thanks all,
ZathHi Zath,
You are trying to equal a string to a type Control. Which does not make sense. Its like equalling a line of text to your monitor. A Control has so many properties, like control ID, child controls, Parent and blah blah. So now, what you are trying to achieve and why
Thanks for the reply.
I have 4 imagas on a page. Depending on the number in the db field, I want the number of images to be visible.
'For i = 1 To intCnt 'intCnt is the number in the field
' sTmp = ("imgTest" & i) 'For the image names - imgTest1, imgTest2......
' j = CType(sTmp, Control) ' This line doesn't work
' j.Visible = True
'Next
Now it can be done with some if then statements, but if I ever increase the number above 4 in the db, then I will have to adjust the code.
And all the images are the same.
If there is a better way to do this, any suggestions are appreciated.
Zath
For i = 1 To intCnt
j = FindControl("imgTest" + i.ToString())If Not j Is Nothing Then
j.Visible = True
End If
Next
Cool, thanks! Worked great.
Should have thought of that. I use the findcontrol for datagrid templates all the time....
Zath
0 comments:
Post a Comment