473,385 Members | 1,642 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Can't access controls programmatically when they are in a FormView control

Hello,

I have a FormView control that has a CheckBoxList in the Item
template...

I wrote this code to access a CheckBoxList in a FormView template...

dim foo as checkboxlist
foo = Me.fvVehicle.FindControl("cblSafety")
foo.items(0).selected = true

This code does not set the check box in the cbl. No errors, but nothing
happens.

If the checkBoxList is moved out of the the FormView control, then this
works fine:

cblSafety.Items(0).selected = true

But I can't refernence the cbl control by name if it's in the FormView.
Therefore this approach will not work at all.

I also tried it by ID and it didn't work either...
dim foo as Integer
foo = me.fvVehicle.FindControl("cblSafety").ID
dim bar as CheckBoxList
bar = me.FindControl(foo)
bar.Items(0).Selected = True
Any thoughts?

Bill
Cincinnati, OH USA

Sep 17 '06 #1
0 1177

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Guenter | last post by:
Hi, I am trying to use the ASP.NET 2.0 FormView as a method to enter data into my business object. At the moment, I am trying to do this without a custom DataSourceView control, but I can't...
5
by: Just Me | last post by:
Given a button name Btn_5 and Index=5 I want to do something like dim zz as string = Btn_??Index??.Text or given an array of buttons, do:
1
by: photo | last post by:
Hi! I am new to .net (vb) and moving from classic asp. I ran into a problem that has left me with less hair on my head. For some reason, my button and calendar that sits inside an...
3
by: Scott at Cedar Creek | last post by:
Can I put a repeater inside a FormView? Can I put a repeater inside that repeater? If so, what happens when the FormView.Mode is "Edit?" When they click the EDIT button is my repeater data also...
2
by: wikkiwikkiwaa | last post by:
hello, i am trying to access controls inside my formview1 nested inside loginview1. you cannot access the formview1 unless you are properly logged in. for loginview1, that seems to be fairly...
3
by: nicomp | last post by:
Hello, I have a FormView control that has a CheckBoxList in the Item template... I wrote this code to access a CheckBoxList in a FormView template... dim foo as checkboxlist foo = ...
5
by: Nathan Sokalski | last post by:
I have a FormView control in which I use a PagerTemplate. I am having trouble accessing the controls in the PagerTemplate. How do I access them, and in what event should I put the could that...
4
by: dizzy77 | last post by:
Is it possible to select specific row of FormView control by DataKeyName or row ID from code behind programmatically. Assuming that FormView is binded to standard ObjectDataSource control. ...
0
by: Rafter | last post by:
Hi, I am using a server controls (textbox, dropdownlist, calendar) inside of a form view, it seems that the .Net framework (VB.Net & Net Frame Work 2.0) makes it difficult to access the control...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.