How Does One Acquire The Widget Instance From JavaScript?

Aug 20, 2008 at 7:24 PM
Edited Aug 20, 2008 at 7:25 PM
Hi All,

I was just wondering... how does one acquire the widget instance from JavaScript?

Basically, I have a Text Box called, "txtTextBox" and I would normally do this:

textBox = document.getElementById("txtTextBox");

However, I have discovered that dropthings has to work by assigning controls new names for run time, so I have to do this:

textBox = document.getElementById(
"WidgetPanelsLayout_WidgetContainer841_Widget841_txtTextBox");

That's all very well, but the number in there (841) refers to the widget instance ID from the WidgetInstance table, which means it will change for every user. LOL!

Okay, I discovered that in the .cs / codebehind I can refer to the widget instance with something like this:

this.Host.ID.ToString();

So, my first thought was GREAT, I can put that in a hidden field, like so:

hiddenField.Value = String.Format("WidgetPanelsLayout_WidgetContainer{0}_Widget{0}_txtTextBox"this.Host.ID.ToString());

only then to realise how stupid that was, because I would still need the widget instance to refer to the hidden field with somethign like:

textBox = document.getElementById("hiddenField").value;

Hmmmm.... now I am in a fix.... can anyone help??   :-D

Cheers!