I have a problem with asp.net 4.
When I add an attribute on the controls, then its encoding is rendered.
For example, when I type this code
txtQuestion.Attributes["onfocus"] =
"if(this.value == this.title)
{
this.value = '';
this.style.backgroundColor='#FEFDE0';
this.style.color='#000000';
}";
I get rendering
onfocus="if(this.value == this.title){this.value =
'';this.style.backgroundColor='#FEFDE0';
this.style.color='#000000';}"
And every hash ' changed to & # 39;
Is there a way to disable this new future only on some controls ? or an easy way to make your own render?
My unsuccessful attempt
Everything is ready for me, some think, but I fail. For example, this fails.
txtQuestion.RenderingCompatibility = new Version("3.5");
I also find that these attributes are displayed and are on
public virtual void RenderBeginTag (HtmlTextWriterTag tagKey) ,
, , , .
asp net , EncodeType - , - , , , , .
, .
, Microsoft .
txtQuestion.Attributes["onfocus"] =
"if(this.value == this.title){this.value = '';this.style.backgroundColor='#FEFDE0';this.style.color='#000000';}";
.
Page.ClientScript.RegisterExpandoAttribute(txtQuestion.ClientID, "onfocus",
"if(this.value == this.title){this.value = '';this.style.backgroundColor='#FEFDE0';this.style.color='#000000';}");
MS- , script, onfocus JavaScript.
jQuery , , .
, , , , , - MS.