Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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:

 

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?

Posted

Hi! It's me again. I figured out how to do what I wanted. long story short, this is how I've done it:

       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 ;)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...