how to get form id in a composite control?

R

Robin Lilly'

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
 
S

Scott Mitchell [MVP]

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
(e-mail address removed)
http://www.4GuysFromRolla.com

* When you think ASP.NET, think 4GuysFromRolla.com!
 
R

Robin Lilly

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top