A
Andrea
Well,
I've tried to create a stupid custom validator to validate a checked checkbox.
Really simple, really stupid, but it's just for trying to do something better
than standard validator, that works great but has some limits.
Ok, this is what i've done (apart from the basic implementation that should
be done):
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
if (RenderUplevel)
{
string script = "\r\n<script language=\"javascript\">\r\n" +
...............
to implement the script
and
protected override void AddAttributesToRender(HtmlTextWriter writer)
{
//writer.AddAttribute("controltovalidate", this.GetControlRenderID(ControlToValidate));
base.AddAttributesToRender(writer);
if (this.RenderUplevel)
{
String clientID = this.ClientID;
Page.ClientScript.RegisterExpandoAttribute(clientID, "evaluationfunction",
"IsCheckBoxRequired");
...............
to add the javascript elements to the javascript code rendered by the framework.
I've tried both Firefox and IE, on XP PRO nor on a Windows 2003. In both
case IE seems to works, but in firefox doesn't.
At least the client-script doesn't fire.
Infact checking in the source code the
ctl00_MainContent_Control.evaluationfunction = "JavascriptFunctionName";
isn't there despite the RegisterExpandoAttribute set it correctly. Using
the writer.AddAttribute() in the AddAttributeToRender doesn't work either.
I really don't know.
I'm exausted and upset. I wasted half day to understand the reason ...
Any help?
Thanks Andrea
I've tried to create a stupid custom validator to validate a checked checkbox.
Really simple, really stupid, but it's just for trying to do something better
than standard validator, that works great but has some limits.
Ok, this is what i've done (apart from the basic implementation that should
be done):
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
if (RenderUplevel)
{
string script = "\r\n<script language=\"javascript\">\r\n" +
...............
to implement the script
and
protected override void AddAttributesToRender(HtmlTextWriter writer)
{
//writer.AddAttribute("controltovalidate", this.GetControlRenderID(ControlToValidate));
base.AddAttributesToRender(writer);
if (this.RenderUplevel)
{
String clientID = this.ClientID;
Page.ClientScript.RegisterExpandoAttribute(clientID, "evaluationfunction",
"IsCheckBoxRequired");
...............
to add the javascript elements to the javascript code rendered by the framework.
I've tried both Firefox and IE, on XP PRO nor on a Windows 2003. In both
case IE seems to works, but in firefox doesn't.
At least the client-script doesn't fire.
Infact checking in the source code the
ctl00_MainContent_Control.evaluationfunction = "JavascriptFunctionName";
isn't there despite the RegisterExpandoAttribute set it correctly. Using
the writer.AddAttribute() in the AddAttributeToRender doesn't work either.
I really don't know.
I'm exausted and upset. I wasted half day to understand the reason ...
Any help?
Thanks Andrea