Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

user control question

Status
Not open for further replies.

mgriffith

MIS
Jul 3, 2001
177
US
does anyone know how i could go about writing something like this out:
-------------------------
<span id=&quot;_ctl32_Combo3_StatusDisplaySpan&quot;
onblur=&quot;ComboBlur('_ctl32:Combo3');&quot;
onfocus=&quot;ComboFocus('_ctl32:Combo3');&quot;>
</span>
</span>
<script language=javascript>
var this_c=&quot;_ctl32:Combo3&quot;;
...
</script>
-----------------------

i don't have a problem actually creating the span or anything...what i need to figure out is how can i get the name part at run time ('_ctl32:Combo3').

it's for a javascript that requires the name prefix to do stuff...there's going to be many of the span/script blocks on a page, and it's going to do something like

eval(this_c + &quot;_StatusDisplaySpan&quot;).innertext = &quot;whatever&quot;;

any ideas?? need more clarification??

thanks. mike griffith
----------------------------
mgriffith@lauren.com
mdg12@po.cwru.edu
 
ok i got it...i have code in my .ascx file, but in my codebehind i've now put (and it works!!)

------------------------------
protected override void OnPreRender (EventArgs e)
{
Page.RegisterClientScriptBlock(
&quot;&quot;, &quot;<script language=\&quot;javascript\&quot; src=\&quot;DbComboServer.js\&quot;></script>&quot;);

Page.RegisterClientScriptBlock(
&quot;&quot;, &quot;<script language=\&quot;javascript\&quot; src=\&quot;usrCobTemplateJs.js\&quot;></script>&quot;);
}

protected override void Render (HtmlTextWriter writer)
{
base.Render(writer);
writer.Write(
&quot;<script language=\&quot;javascript\&quot;>\n&quot; +
&quot;<!--\n&quot;+
&quot;var this_c=\&quot;&quot; +
this.ID +
&quot;\&quot;;\n&quot; +
&quot;eval(DbComboStringToEval(this_c, \&quot;Please Wait...\&quot;, \&quot;No results.\&quot;, 10, false, \&quot;tblName\&quot;, \&quot;colDisplayName\&quot;, \&quot;colSearchText\&quot;, \&quot;colIdent\&quot;));\n&quot; +
&quot;DbComboInit(this_c);\n&quot; +
&quot;-->\n&quot;+
&quot;</script>&quot;);
}
-------------------------------

i forgot that ID is derived from the base class! oh well. mike griffith
----------------------------
mgriffith@lauren.com
mdg12@po.cwru.edu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top