how to get form id in a composite control?

Discussion in 'ASP .Net Building Controls' started by Robin Lilly', Nov 18, 2004.

  1. Robin Lilly'

    Robin Lilly' Guest

    Hi,

    I have a composite control that I need to reference the form id to build
    some javascript that I am pushing out several places, such as:

    _Anchor.Attributes.Add("OnClick", "JavaScript:popUpCalendar(this, document."
    & _formId & ".elements['" & _TextBox.UniqueID & "'], ""m/d/yyyy"")")



    Where _formId would need to be the page form tag.

    Thanks,

    Robin
    Robin Lilly', Nov 18, 2004
    #1
    1. Advertising

  2. Robin, I've wondered this myself, and after poking through the source
    code using Reflector [http://www.aisto.com/roeder/dotnet/], I was unable
    to find a means. The approach used by Steve Stchur in this article,
    Maintaining Scroll Position on Postback
    [http://aspnet.4guysfromrolla.com/articles/111704-1.aspx], offers one
    workaround - recursing through the control hierarchy, searching for an
    HtmlForm object.

    If there is another way, please let me know! :)

    --

    Scott Mitchell

    http://www.4GuysFromRolla.com

    * When you think ASP.NET, think 4GuysFromRolla.com!
    Scott Mitchell [MVP], Nov 18, 2004
    #2
    1. Advertising

  3. Robin Lilly'

    Robin Lilly Guest

    Scott,

    Thanks for the reply. I'm going to take the one from Steve and put it in
    a Utilites class. I had been really struggling looking at the page
    class, searching, etc trying to figure where the "form id tag" property
    was located.

    Thanks,

    Robin Lilly
    http://www.iLogBook.com

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    Robin Lilly, Nov 19, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    707
  2. sleigh
    Replies:
    1
    Views:
    2,666
    sleigh
    Feb 12, 2004
  3. shapper
    Replies:
    6
    Views:
    942
    shapper
    Dec 26, 2007
  4. Chad
    Replies:
    0
    Views:
    209
  5. Mike

    Composite vs non composite Controls

    Mike, Mar 10, 2005, in forum: ASP .Net Web Controls
    Replies:
    4
    Views:
    249
    Sundararajan
    Mar 11, 2005
Loading...

Share This Page