How to return a radiobuttonlist control in fromview control

S

snow

Hi All,

Here is my code:

Dim r As RadioButtonList
r = CType(anFormView.FindControl("RadioButtonList1"), RadioButtonList)

when I debug the code, r is nothing. What am I doing wrong?
RadioButtonList1 is the control ID.

Thanks for the help!
 
C

Cor

Are you sure that the anFromView exist when you use this code?

That is not always the case in a page form

Simple debugging and placing your cursor on the anFormView as it breaks on
the breakpoint behind that, makes this probably direct clear.

Cor

"snow" wrote in message

Hi All,

Here is my code:

Dim r As RadioButtonList
r = CType(anFormView.FindControl("RadioButtonList1"), RadioButtonList)

when I debug the code, r is nothing. What am I doing wrong?
RadioButtonList1 is the control ID.

Thanks for the help!
 
S

snow

I get the radiobuttonlist return, but when I set it is visible or
invisible, it is not updated.

for example,
Dim r As Button = FormView1.FindControl("RadioButtonList1")
if case1 = true then
r.visible = true
else
r.visible = false
end if

The code seems good, but when run the program, the radiobuttonlist
control does not make a change. Why?
 
S

snow

Sorry, it should be a radiobuttonlist in the code.

I get the radiobuttonlist return, but when I set it is visible or
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top