<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>IT Creatings Blog &#187; javascript</title>
	<atom:link href="http://blog.itcreatings.com/index.php/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.itcreatings.com</link>
	<description>Professional Developers Team</description>
	<lastBuildDate>Wed, 02 Sep 2009 12:01:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Rendering HTML and Javascript in ASP.NET custom controls</title>
		<link>http://blog.itcreatings.com/index.php/2009/06/rendering-html-and-javascript-in-asp-net-custom-controls/</link>
		<comments>http://blog.itcreatings.com/index.php/2009/06/rendering-html-and-javascript-in-asp-net-custom-controls/#comments</comments>
		<pubDate>Sat, 27 Jun 2009 20:54:46 +0000</pubDate>
		<dc:creator>Soutlan</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[custom controls]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://localhost:8083/blog.itcreatings.com/?p=7</guid>
		<description><![CDATA[&#160;Welcome to the ITCreatings Developers blogs!
So we are starting to write&#160;articles for developers. We plan to create a series of blog posts, where some of our .net, JavaScript and other techniques will be described. It is some tips about how we build our project, what technologies we use and how we extend some default Microsoft [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp;Welcome to the ITCreatings Developers blogs!</p>
<p style="color: rgb(85, 85, 85);" class="MsoNormal"><span lang="EN-US">So we are starting to write&nbsp;</span><span lang="EN-US">articles for developers. We plan to create a series of blog posts, where some of our .net, JavaScript and other techniques will be described. It is some tips about how we build our project, what technologies we use and how we extend some default Microsoft .NET functionality.</span></p>
<p style="color: rgb(85, 85, 85);" class="MsoNormal"><span lang="EN-US">So, lets start with simple thing and I hope we will continue with many useful features and code samples.</span></p>
<p style="color: rgb(85, 85, 85);" class="MsoNormal"><strong><span lang="EN-US">A brief preview so far.</span></strong></p>
<p style="color: rgb(85, 85, 85);">&nbsp;&nbsp; &nbsp; &#8211; We are creating custom DB layer (<a href="http://ndb.codeplex.com/" style="color: rgb(159, 102, 102); text-decoration: none; font-family: Arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 1.2; font-size-adjust: none; font-stretch: normal; background-image: url(http://blog.itcreatings.com/pics/remote.gif); background-repeat: no-repeat; padding-right: 10px; white-space: nowrap; background-position: 100% 0%;" target="_blank" title="Ndb Library - .NET ORM database layer">Ndb Library</a>).<br />
&nbsp;&nbsp; &nbsp; -&nbsp;We are creating custom web data handlers, an alternative for SOAP Web services or WCF Services.<br />
&nbsp;&nbsp; &nbsp; -&nbsp;We are creating custom web controls, based on popular JQuery JavaScript framework and server side HTML and JavaScript generation.</p>
<p style="color: rgb(85, 85, 85);" class="MsoNormal">&nbsp;<span id="more-7"></span></p>
<p style="color: rgb(85, 85, 85);" class="MsoNormal"><span lang="EN-US"><strong>This post is about how to simplify life of ASP.NET custom controls developer.</strong></span></p>
<p style="color: rgb(85, 85, 85);" class="MsoNormal"><span lang="EN-US"><br />
Let see what we have by default when try to create some web control.</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; text-indent: 35.4pt; line-height: normal;" class="MsoNormal"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">writer.AddAttribute(<span style="color: rgb(43, 145, 175);">HtmlTextWriterAttribute</span>.Id, ID);<br />
</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>writer.AddAttribute(<span style="color: rgb(43, 145, 175);">HtmlTextWriterAttribute</span>.Class, CssClass);<br />
</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>writer.RenderBeginTag(<span style="color: rgb(43, 145, 175);">HtmlTextWriterTag</span>.Div);&nbsp;</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span style="color: green;">//&lt;/div id=&quot;someID&quot; class=&quot;someClass&quot;&gt;</span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: green;"><br />
</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>writer.RenderEndTag();&nbsp;<span style="color: green;">//&lt;/div&gt;<br />
</span></span><span lang="EN-US" style="font-size: 10pt; line-height: 14px; font-family: 'Courier New';"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>writer.Write(<span style="color: rgb(163, 21, 21);">&quot;\r\n&quot;</span>);</span></p>
<p><span lang="EN-US">This is just to render div html tag, and imaging what if we need to render complex Table or something else.<br />
The simpler way is</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">writer.Write(<span style="color: rgb(163, 21, 21);">&quot;&lt;div id=&#8217;&quot;</span>&nbsp;+ ID +&nbsp;<span style="color: rgb(163, 21, 21);">&quot;&#8217; class=&#8217;&quot;</span>&nbsp;+ CssClass +&nbsp;<span style="color: rgb(163, 21, 21);">&quot;&#8217;&gt;&lt;/div&gt;&quot;</span>);</span></p>
<p style="color: rgb(85, 85, 85);" class="MsoNormal"><span lang="EN-US">This is just one code line instead of five above, but when we need to create something really usable in our projects this will be not one hundred of code lines. I think it&rsquo;s boring to write such kind of code, not saying about understand it in future.</span></p>
<p style="color: rgb(85, 85, 85);" class="MsoNormal"><span lang="EN-US">Another situation &#8211; we need to render some JavaScript code. This is the same story:</span></p>
<p style="color: rgb(85, 85, 85);" class="MsoNormal">&nbsp;</p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">writer.Write(<span style="color: rgb(163, 21, 21);">&quot;&lt;script type=&#8217;text/javascript&#8217; &gt;\r\n&quot;</span>);<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
</span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">writer.Write(<span style="color: rgb(163, 21, 21);">&quot;function &quot;</span>&nbsp;+ dataLoadFunction +&nbsp;<span style="color: rgb(163, 21, 21);">@&quot;(someID){&quot;</span>);<span>&nbsp;&nbsp;&nbsp;&nbsp;</span><span>&nbsp;&nbsp;&nbsp;&nbsp;</span><span>&nbsp;&nbsp;&nbsp;&nbsp;<br />
</span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">writer.Write(<span style="color: rgb(163, 21, 21);">@&quot;</span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: rgb(163, 21, 21);"><span>&nbsp;&nbsp; &nbsp;<br />
</span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: rgb(163, 21, 21);"><span>&nbsp;&nbsp; &nbsp; &nbsp;</span>showLoading();<br />
</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: rgb(163, 21, 21);">&nbsp;&nbsp; &nbsp; &nbsp;var params = { action: someAction, id: someID};<br />
</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: rgb(163, 21, 21);">&nbsp;&nbsp; &nbsp; &nbsp;someLoadFunction(&#8217;&quot;</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">&nbsp;+ WebServiceName +&nbsp;<span style="color: rgb(163, 21, 21);">@&quot;&#8217;, params,<br />
</span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: rgb(163, 21, 21);">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;function(response) {<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
</span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: rgb(163, 21, 21);"><span>&nbsp;&nbsp; &nbsp;</span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>if (response != undefined)) {<br />
</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: rgb(163, 21, 21);"><span>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span>&quot;</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">&nbsp;+ dataBindFunction +&nbsp;<span style="color: rgb(163, 21, 21);">@&quot;(response);<br />
</span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: rgb(163, 21, 21);"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>hideLoading();<br />
</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: rgb(163, 21, 21);"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>}<br />
</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: rgb(163, 21, 21);">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else showError();<br />
</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: rgb(163, 21, 21);">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: rgb(163, 21, 21);">);<br />
</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: rgb(163, 21, 21);">&quot;</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">);<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
</span></span><span lang="EN-US" style="font-size: 10pt; line-height: 14px; font-family: 'Courier New';">writer.Write(<span style="color: rgb(163, 21, 21);">&quot;} \r\n&quot;</span>);<br />
</span><span lang="EN-US" style="font-size: 10pt; line-height: 14px; font-family: 'Courier New';">writer.Write(<span style="color: rgb(163, 21, 21);">&quot;&lt;/script&gt;&quot;</span>);<br />
</span><span lang="EN-US" style="font-size: 10pt; line-height: 14px; font-family: 'Courier New';">&nbsp;</span></p>
<p style="color: rgb(85, 85, 85);" class="MsoNormal"><span lang="EN-US">And this will render just (don&rsquo;t mind about formatting):</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: blue;">&lt;</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: rgb(163, 21, 21);">script</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">&nbsp;<span style="color: red;">type</span><span style="color: blue;">=&quot;text/javascript&quot;&gt;</span><span>&nbsp;&nbsp; &nbsp; &nbsp;<br />
</span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: blue;">&nbsp;&nbsp; &nbsp;function</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">&nbsp;dataLoadFunction(someID) {<span>&nbsp;</span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span>&nbsp;&nbsp;</span>showLoading();<br />
</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</span>var params = {action:<span style="color: rgb(163, 21, 21);">&nbsp;&#8217;someAction&#8217;</span>, id: someID };<span>&nbsp;&nbsp;&nbsp;<br />
</span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</span>someLoadFunction(<span style="color: rgb(163, 21, 21);">&#8216;loadDataService&#8217;</span>, params,<br />
</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: blue;">function</span>(response) {<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
</span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: blue;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">&nbsp;(response != undefined)) {<br />
</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bindData(response);<br />
</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span>&nbsp;&nbsp;&nbsp;</span>hideLoading();<br />
</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>}<br />
</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: blue;">else</span>&nbsp;showError();<br />
</span><span style="font-size: 10pt; font-family: 'Courier New';">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</span><span style="font-size: 10pt; font-family: 'Courier New';">);<br />
</span><span style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp;&nbsp;&nbsp;</span>}<br />
</span><span style="font-size: 10pt; line-height: 14px; font-family: 'Courier New'; color: blue;">&lt;/</span><span style="font-size: 10pt; line-height: 14px; font-family: 'Courier New'; color: rgb(163, 21, 21);">script</span><span style="font-size: 10pt; line-height: 14px; font-family: 'Courier New'; color: blue;">&gt;</span></p>
<p style="color: rgb(85, 85, 85);" class="MsoNormal"><span lang="EN-US">In my practice of developing web custom controls I had to write a lot of such code &#8211; HTML and JavaScript.<br />
And believe me there is no fun when you need to support this controls, refractor, add some new logic or else.<br />
So now an interest part &ndash; how we changed the things about writing code, as in examples above.</span></p>
<p style="color: rgb(85, 85, 85);" class="MsoNormal"><strong><span lang="EN-US">Check this out, our JS and HTML helper classes in action.</span></strong></p>
<p style="color: rgb(85, 85, 85);" class="MsoNormal"><span lang="EN-US">&nbsp;</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: green;">// writer is and HtmlTextWriter instance.<br />
</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: rgb(43, 145, 175);">Html</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">&nbsp;Html = new Html(writer);</span><span lang="EN-US">&nbsp;</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US">&nbsp;</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">Html.Div(Html.Attributes(<span style="color: rgb(163, 21, 21);">&quot;id&quot;</span>, ID,&nbsp;<span style="color: rgb(163, 21, 21);">&quot;class&quot;</span>, CssClass), () =&gt;<br />
{<br />
</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">&nbsp;&nbsp; &nbsp;writer.Write(<span style="color: rgb(163, 21, 21);">&quot;You can still use wirter <br />
</span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span style="color: rgb(163, 21, 21);">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;object to render contents or&#8230;&quot;</span>);<br />
</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: green;">&nbsp;&nbsp; &nbsp;// &#8230; use our cool helper class <br />
</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: green;">&nbsp;&nbsp; &nbsp;// to render tags with annonimous functions.</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp; &nbsp;</span>Html.A(Html.Attributes(<span style="color: rgb(163, 21, 21);">&quot;href&quot;</span>,&nbsp;<span style="color: rgb(163, 21, 21);">&quot;http://www.itcreatigs.com&quot;</span>), <br />
&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; () =&gt;&nbsp;</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">Html.Write(<span style="color: rgb(163, 21, 21);">&quot;Click here.&quot;</span>));<br />
</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: green;">&nbsp;&nbsp; &nbsp;// most common method<br />
</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">&nbsp;&nbsp; &nbsp;Html.Tag(<span style="color: rgb(43, 145, 175);">HtmlTextWriterTag</span>.Form<span style="color: rgb(163, 21, 21);">,</span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">Html.Attributes(<span style="color: rgb(163, 21, 21);">&quot;action&quot;</span>,<span style="color: rgb(163, 21, 21);">&quot;./ &quot;</span>), <br />
</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">&nbsp;&nbsp; &nbsp;() =&gt;&nbsp;{</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; text-indent: 35.4pt; line-height: normal;" class="MsoNormal"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp;</span><span style="color: green;">// some Html.Input overloads<br />
</span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Html.TextBox(<span style="color: rgb(163, 21, 21);">&quot;name&quot;, &quot;Name&quot;, &quot;value&quot;, &quot;Nikolay Grachov&quot;</span>);<br />
</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Html.Intput(Html.Attributes(<span style="color: rgb(163, 21, 21);">&quot;type&quot;</span>,&nbsp;<span style="color: rgb(163, 21, 21);">&quot;password&quot;, &quot;name&quot;, &quot;Password&quot;</span>));<br />
</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Html.Intput(<span style="color: rgb(163, 21, 21);">&quot;submit&quot;, &quot;Submit&quot;, &quot;Login&quot;</span>);<br />
</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">&nbsp;&nbsp; &nbsp; }</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">});</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">&nbsp;</span><span lang="EN-US">&nbsp;<br />
</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US">This will render:</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: blue;"><span>&nbsp;&nbsp;&nbsp;&nbsp;</span>&lt;</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: rgb(163, 21, 21);">div</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">&nbsp;<span style="color: red;">id</span><span style="color: blue;">=&quot;someID&quot;</span>&nbsp;<span style="color: red;">class</span><span style="color: blue;">=&quot;someClass&quot;&gt;<br />
</span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>You can still use wirter <br />
</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;object </span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">to render contents or&#8230;</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: blue;">&lt;</span><span style="color: rgb(163, 21, 21);">a</span>&nbsp;<span style="color: red;">href</span><span style="color: blue;">=&quot;http://www.itcreatings.com&quot;&gt;</span>Click here.<span style="color: blue;">&lt;/</span><span style="color: rgb(163, 21, 21);">a</span><span style="color: blue;">&gt;<br />
</span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: blue;">&lt;</span><span style="color: rgb(163, 21, 21);">form</span>&nbsp;<span style="color: red;">action</span><span style="color: blue;">=&quot;./&quot;&gt;<br />
</span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: blue;">&lt;</span><span style="color: rgb(163, 21, 21);">input</span>&nbsp;<span style="color: red;">type</span><span style="color: blue;">=&quot;text&quot;</span>&nbsp;<span style="color: red;">name</span><span style="color: blue;">=&quot;Name&quot;</span>&nbsp;<span style="color: red;">value</span><span style="color: blue;">=&quot;Nikolay Grachov&quot;</span>&nbsp;<span style="color: blue;">/&gt;<br />
</span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: blue;">&lt;</span><span style="color: rgb(163, 21, 21);">input</span>&nbsp;<span style="color: red;">type</span><span style="color: blue;">=&quot;password&quot;</span>&nbsp;<span style="color: red;">name</span><span style="color: blue;">=&quot;Password&quot;</span><span>&nbsp;&nbsp;</span><span style="color: blue;">/&gt;<br />
</span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: blue;">&lt;</span><span style="color: rgb(163, 21, 21);">input</span>&nbsp;<span style="color: red;">type</span><span style="color: blue;">=&quot;submit&quot;</span>&nbsp;<span style="color: red;">name</span><span style="color: blue;">=&quot;Submit&quot;</span>&nbsp;<span style="color: red;">value</span><span style="color: blue;">=&quot;Login&quot;</span><span>&nbsp;&nbsp;</span><span style="color: blue;">/&gt;<br />
</span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span><span style="font-size: 10pt; font-family: 'Courier New'; color: blue;">&lt;/</span><span style="font-size: 10pt; font-family: 'Courier New'; color: rgb(163, 21, 21);">form</span><span style="font-size: 10pt; font-family: 'Courier New'; color: blue;">&gt;<br />
</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: blue;">&lt;/</span><span style="color: rgb(163, 21, 21);">div</span><span style="color: blue;">&gt;</span></span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US">&nbsp;</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US">And what about JavaScript? There is more complex stuff, see what we have so far:</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US">&nbsp;</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: rgb(43, 145, 175);">Js</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">&nbsp;js =&nbsp;<span style="color: blue;">new</span>&nbsp;<span style="color: rgb(43, 145, 175);">Js</span>(writer);</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><br />
</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: green;">// render Script tag<br />
</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">Html.Script(Html.Attributes(<span style="color: rgb(163, 21, 21);">&quot;type&quot;</span>,&nbsp;<span style="color: rgb(163, 21, 21);">&quot;text/javascript&quot;</span>),()=&gt;<br />
{<br />
</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: green;">&nbsp;&nbsp; // function declaration<br />
</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp; </span>js.Function(<span style="color: rgb(163, 21, 21);">&quot;dataLoadFunction&quot;</span>,&nbsp;<span style="color: rgb(163, 21, 21);">&quot;someID&quot;</span>,()=&gt;<br />
<span>&nbsp;</span><span>&nbsp;&nbsp;</span>{</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: green;">// and now let&#8217;s see what we can use with JS helper..</span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: green;"><span>&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp; &nbsp; &nbsp;<br />
&nbsp;&nbsp; &nbsp; &nbsp;// call function without parameters<br />
</span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>js.Call(<span style="color: rgb(163, 21, 21);">&quot;showLoading&quot;</span>);&nbsp;<br />
</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: green;">// init json object<span>&nbsp;&nbsp;&nbsp;<br />
</span></span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: green;"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">js.Var(<span style="color: rgb(163, 21, 21);">&quot;params&quot;</span>, js.JsonParams(<span style="color: rgb(163, 21, 21);">&quot;action&quot;</span>,&nbsp;<span style="color: rgb(163, 21, 21);">&quot;&#8217;someAction&#8217;&quot;</span>,&nbsp;<span style="color: rgb(163, 21, 21);">&quot;id&quot;</span>,<span style="color: rgb(163, 21, 21);">&quot;someID&quot;</span>));<br />
</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: green;"><span>&nbsp;&nbsp; &nbsp; &nbsp;</span>// call function with 2 parameters, <br />
</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: green;">&nbsp;&nbsp; &nbsp; &nbsp;// where the second is callback(response)<br />
</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>js.Call(<span style="color: rgb(163, 21, 21);">&quot;someLoadFunction&quot;</span>,&nbsp;<span style="color: rgb(163, 21, 21);">&quot;params&quot;</span>,&nbsp;<span style="color: rgb(163, 21, 21);">&quot;response&quot;</span>,<br />
&nbsp;&nbsp; &nbsp; &nbsp;() =&gt;&nbsp;{<br />
</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;</span><span>&nbsp;&nbsp;</span><span style="color: green;">// IF/ELSE statement<br />
</span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>js.If(<span style="color: rgb(163, 21, 21);">&quot;response != undefined&quot;</span>, ()=&gt;<br />
<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>{<br />
</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style="color: green;">// more calls<br />
</span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span>js.Call(<span style="color: rgb(163, 21, 21);">&quot;someDataBindFunction&quot;</span>,<span style="color: rgb(163, 21, 21);">&quot;response&quot;</span>);<span><br />
</span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span>&nbsp;&nbsp;&nbsp;</span>js.Call(<span style="color: rgb(163, 21, 21);">&quot;hideLoading&quot;</span>);<span><br />
</span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>}).Else(()=&gt;<br />
<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>{<br />
</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span>js.Call(<span style="color: rgb(163, 21, 21);">&quot;showError&quot;</span>);<br />
</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span></span><span style="font-size: 10pt; font-family: 'Courier New';">});<br />
</span><span style="font-size: 10pt; font-family: 'Courier New';">&nbsp;&nbsp; &nbsp; &nbsp;});<br />
</span><span style="font-size: 10pt; font-family: 'Courier New';">&nbsp;&nbsp; });<br />
</span><span style="font-size: 10pt; font-family: 'Courier New';">});</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">&nbsp;</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US">That&rsquo;s it! What do you think? Course it&rsquo;s just simple examples, all these helper methods has many overloads, which can render allmost all js code you need.</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US"><strong>Like JQuery?</strong><span><strong>&nbsp;</strong></span></span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US">Me too, so:</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">Html.Script(Html.Attributes(<span style="color: rgb(163, 21, 21);">&quot;type&quot;</span>,&nbsp;<span style="color: rgb(163, 21, 21);">&quot;text/javascript&quot;</span>),()=&gt;<br />
{</span></p>
<p style="margin: 0cm 0cm 0.0001pt 35.4pt; color: rgb(85, 85, 85); line-height: normal;" class="MsoNormal"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">js._(<span style="color: rgb(163, 21, 21);">&quot;document&quot;</span>).Ready(()=&gt;<br />
{</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>js._(<span style="color: rgb(163, 21, 21);">&quot;#someID&quot;</span>)</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>.Click(() =&gt; js.Call(<span style="color: rgb(163, 21, 21);">&quot;someClickEventHandler&quot;</span>))</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>.Event(<span style="color: rgb(163, 21, 21);">&quot;moseover&quot;</span>, () =&gt; js.Call(<span style="color: rgb(163, 21, 21);">&quot;someMouseEventHandler&quot;</span>))</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span>&nbsp;&nbsp;&nbsp;</span>.Hide()</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span>&nbsp;&nbsp;&nbsp;</span>.Show()</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span>&nbsp;&nbsp;&nbsp;</span>.Attr(<span style="color: rgb(163, 21, 21);">&quot;myAttr&quot;</span>,&nbsp;<span style="color: rgb(163, 21, 21);">&quot;myAttrValue&quot;</span>).rn();</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>js.Var(<span style="color: rgb(163, 21, 21);">&quot;someHtml&quot;</span>, ()=&gt; js._(<span style="color: rgb(163, 21, 21);">&quot;#someDiv&quot;</span>).Html());</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>js._(<span style="color: rgb(163, 21, 21);">&quot;#someDiv&quot;</span>).Empty().rn();</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; text-indent: 35.4pt; line-height: normal;" class="MsoNormal"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">});</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">});</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US">This will render:</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: blue;">&lt;</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: rgb(163, 21, 21);">script</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">&nbsp;<span style="color: red;">type</span><span style="color: blue;">=&quot;text/javascript&quot;&gt;</span><span>&nbsp;&nbsp;&nbsp;<br />
</span></span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal">&nbsp;</p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; text-indent: 35.4pt; line-height: normal;" class="MsoNormal"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">$(document).ready(funtion(){</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>$(<span style="color: rgb(163, 21, 21);">&quot;#someID&quot;</span>)</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>.click(<span style="color: blue;">function</span>&nbsp;() { someClickEventHandler(); })</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>.moseover(<span style="color: blue;">function</span>&nbsp;() { someMouseEventHandler(); })</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>.hide()</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>.show()</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>.attr(<span style="color: rgb(163, 21, 21);">&quot;myAttr&quot;</span>,&nbsp;<span style="color: rgb(163, 21, 21);">&quot;myAttrValue&quot;</span>);</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: blue;">var</span>&nbsp;someHtml = $(<span style="color: rgb(163, 21, 21);">&quot;#someDiv&quot;</span>).html();</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>$(<span style="color: rgb(163, 21, 21);">&quot;#someDiv&quot;</span>).empty();</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span><span style="font-size: 10pt; font-family: 'Courier New';">});</span></p>
<p style="color: rgb(85, 85, 85);">&nbsp;</p>
<p style="color: rgb(85, 85, 85);" class="MsoNormal"><span style="font-size: 10pt; line-height: 14px; font-family: 'Courier New'; color: blue;">&lt;/</span><span style="font-size: 10pt; line-height: 14px; font-family: 'Courier New'; color: rgb(163, 21, 21);">script</span><span style="font-size: 10pt; line-height: 14px; font-family: 'Courier New'; color: blue;">&gt;</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal">&nbsp;</p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><strong><span lang="EN-US">Was this usefull ?</span></strong></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal">I think you notice that not all code looks more simpler and readable then usual ones.<br />
But you shoud undrstand &#8211; that class is nothing more then a&nbsp;<strong>tool</strong>&nbsp;which you can extend in many many ways.</p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal">Don&#8217;t like to write</p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">Html.Script(Html.Attributes(<span style="color: rgb(163, 21, 21);">&quot;type&quot;</span>,&nbsp;<span style="color: rgb(163, 21, 21);">&quot;text/javascript&quot;</span>),()=&gt;<br />
{</span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">});<br />
</span>Fine, write wraper to this function in your control and use just</p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">Script(()=&gt;<br />
{</span></p>
<p style="color: rgb(85, 85, 85);"><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New';">});</span></p>
<p style="color: rgb(85, 85, 85);">like I do that.</p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal">Anyway I hope this article will help you to extend you web controls techniques and write more and faster.</p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal">&nbsp;</p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><span lang="EN-US">Link to download:&nbsp;<a href="http://www.itcreatings.com/codebase/html_js_helpers.zip" style="color: rgb(159, 102, 102); text-decoration: none; font-family: Arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 1.2; font-size-adjust: none; font-stretch: normal; background-image: url(http://blog.itcreatings.com/pics/remote.gif); background-repeat: no-repeat; padding-right: 10px; white-space: nowrap; background-position: 100% 0%;" title="Html and Js hellper for ASP.NET custom controls developing">HTML_JS_helpers.zip</a></span></p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal">&nbsp;</p>
<p style="color: rgb(85, 85, 85); margin-bottom: 0.0001pt; line-height: normal;" class="MsoNormal"><strong>See you in next posts,&nbsp;</strong><span lang="EN-US"><strong>good luck!</strong></span></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.itcreatings.com/index.php/2009/06/rendering-html-and-javascript-in-asp-net-custom-controls/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
