FormView question

ttkalec1

Newcomer
Joined
Feb 26, 2005
Messages
19
I've created an FormView template that collects records from an SQL database. And I've stated that my FormView is pagable. Now my question is, how do I save a text from an label inside that FormView items to a string in a code behind?

The problem is that in code behind I cannot see the label objects inside that FormView. I can see FormView object itself. So I'm not shure if I can via FormView object, see a collection of objects inside it and manipulate with them in runtime like this:

Code:
FormView1.Items.lblName.text = "some other text"
This of course isn't the right syntax, but I was wondering if there is something like this that I can use?


For example: I have an record that shows ID, Name and Age and it shows in labels on my FormView object. Now i want to make a button on that form view, and when I click it, I want it to pass the Name label.text to an string inside my code behind. Is this possible? I think it is, cause it wouldn't make sense if it isn't?
 
Hi! It's me again. I figured out how to do what I wanted. long story short, this is how I've done it:
Code:
        Dim lblID As New Control
        lblID = FormView1.Controls.Item(0).FindControl("ImeLabel")
        lblID.Visible = False
in the code behind you declare new control, then you have to find the control that you are looking yoru in your FormView. When you find it than you can work with it ;)
 
Back
Top