Results 1 to 11 of 11

Thread: Exposing a user control property to page.

  1. #1

    Thread Starter
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464

    Exposing a user control property to page.

    OK, this question is 2 parts.

    The first part is I have a user control that contains an iFrame in it. I need a way to access it through the code behind file of the user control.

    The second part is, I want to take the control created above, and make a property (which is just a property of the iFrame control) available to the page that is hosting this user control.

    How do I do this?

  2. #2

    Thread Starter
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    I really need these answered if anyone can help...

  3. #3
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Ok here is how to access properties and methods of a usercontrol from its hosting page.

    Just make a Protected WithEvents declaration of it in the codebehind. The name must be the same as declared in the html/aspx page as well as have the same type. Then you can use it in the page just as any other object.

  4. #4
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Were you able to work out the problem?

  5. #5

    Thread Starter
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    No, I wasn't.

    The problem is it is an iFrame. For some reason, getting it to be recognized through code is not working the same as other controls.

    It is weird.

    If you can find a way to recognize it, I would appreciate it, because right now I am at a loss. I am thinking it is much different than tags like span and div because it is a inline frame that has it's own document.

    I would be happy with a javascript solution also that posts back the iFrame.Document.Body.innerHTML value to the code in a way I could read it.

    I just am getting started on it today, so I haven't tried much so far today.

  6. #6
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Whats the setup is the iFrame inside the Usercontrol? Can the Usercontrol access the iFrame but the hosting page cannot?

    Nevermind I reread your post and got it.
    Last edited by Edneeis; Aug 19th, 2003 at 12:50 PM.

  7. #7

    Thread Starter
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Right now I have it in a usercontrol, but I tried it in a page directly and couldn't get it to be recognized. What I would like is for it to be in a user control, and expose the innerHTML as a property to the control for the page to be able to use. This would allow me to just drop in the control and use it in other projects.

    To kind of help you see what I am doing, visit this link:
    http://www.devarticles.com/art/1/90/
    I want to create a reusable drop in control so to allow users to create html content that I can store in a database and display on the site.

  8. #8
    Frenzied Member <ABX's Avatar
    Join Date
    Jul 2002
    Location
    Canada eh...
    Posts
    1,622
    Created custom web browser called Kiddie Surfer for children usign Visual Basic 6. It controls children's browsing of the Internet based on the parents preferences. Downloaded by more than 20,000 families world wide.
    i was bored and mainly looking for something interesting to do and for some reason or another read your resume and noticed that you mis-typed the word in bold. Most employers wouldnt thing thats very impressive so i thought you should know about it.

    I really should find something to do. lol
    Tips:
    • Google is your friend! Search before posting!
    • Name your thread appropriately... "I Need Help" doesn't cut it!
    • Always post your code!!!! We can't read your mind!!! (well, at least most of us!)
    • Allways Include the Name and Line of the Exception (if one is occuring!)
    • If it is relevant state the version of Visual Studio/.Net Framwork you are using (2002/2003/2005)


    If you think I was helpful, rate my post
    IRC Contact: Rizon/xous ChakraNET/xous Freenode/xous

  9. #9

    Thread Starter
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Thanks, I appreciate it.

  10. #10
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Hey I saw this: http://msdn.microsoft.com/vbasic/def...-webmatrix.asp about new web controls and say IFrame in the list and remembered this post. So just in case this never got resolved or might be helpful in the future I thought I'd post it.

  11. #11

    Thread Starter
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    I resolved the problem by not using it and going with a different control.

    I will look at the link, thanks...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width