Sep 28, 2012, 2:28 PM
[CLOSED] CSS style of TextField is not updated properly by DirectMethod
Hello
I've noticed strange behaviour of setting additional CSS style via TextField .Cls property.
In my example, once the "required" style is set, other style ("readonly") cannot be set (there is no change at client)
In the opposite direction (readonly > required) it works fine.
What I am doing wrong?
Please examine.
P.K.
test12.aspx
I've noticed strange behaviour of setting additional CSS style via TextField .Cls property.
In my example, once the "required" style is set, other style ("readonly") cannot be set (there is no change at client)
In the opposite direction (readonly > required) it works fine.
What I am doing wrong?
Please examine.
P.K.
test12.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="test12.aspx.cs" Inherits="test12" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.x-theme-slate .readonly { background: #FFFFFF; cursor: default; color:Gray}
.x-theme-slate .required { background: #FFFFCC; cursor: default; color:Black}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
test12.aspx.csusing System;
using System.Collections.Generic;
using System.Web;
using Ext.Net;
public partial class test12 : System.Web.UI.Page
{
private TextField text1;
protected void Page_Load(object sender, EventArgs e)
{
ResourceManager res_man = new ResourceManager();
res_man.DirectMethodNamespace = "dm";
res_man.IDMode = IDMode.Explicit; // explicit client IDs
res_man.Theme = Ext.Net.Theme.Slate;
res_man.DisableViewState = true;
res_man.AjaxViewStateMode = Ext.Net.ViewStateMode.Disabled;
var button1 = new Button("Set readonly");
button1.ID = "button1";
button1.Listeners.Click.Handler = "dm.set_style('readonly');";
var button2 = new Button("Set required");
button2.ID = "button2";
button2.Listeners.Click.Handler = "dm.set_style('required');";
text1 = new TextField();
text1.ID = "text1";
text1.Value = "text1"; // OK
form1.Controls.Add(res_man);
form1.Controls.Add(text1);
form1.Controls.Add(button1);
form1.Controls.Add(button2);
}
[DirectMethod]
public void set_style(string style)
{
text1.Cls = style;
}
}
Last edited by geoffrey.mcgill; Sep 28, 2012 at 9:41 PM.
Reason: [CLOSED]