Groups | Blog | Home
all groups > asp.net building controls > november 2004 >

asp.net building controls : how to get form id in a composite control?


Robin Lilly'
11/18/2004 1:21:16 PM
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
11/18/2004 7:41:20 PM
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 ***
Scott Mitchell [MVP]
11/18/2004 11:44:38 PM
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
mitchell@4guysfromrolla.com
http://www.4GuysFromRolla.com

AddThis Social Bookmark Button