PDA

View Full Version : [CLOSED] V2.1 FieldContainer & FieldDefaults



Aurelio
Sep 14, 2012, 4:00 PM
Hi, i have define a FieldContainer with textField


<ext:FieldContainer ID="FieldContainer1" runat="server">
<FieldDefaults ReadOnly="true" />
<Items>
<ext:TextField ID="txtTaglie" runat="server" FieldLabel="Taglie" AnchorHorizontal="100%">
</ext:TextField>
<ext:TextField ID="txtColore" runat="server" FieldLabel="Colore" AnchorHorizontal="100%">
</ext:TextField>
</Items>
</ext:FieldContainer>


When open the page, the field it's readonly, i need to enable all field in the container in c#, but the command:

FieldContainer1.FieldDefaults.ReadOnly = false;

don't work..



<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<!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 id="Head1" runat="server">
<title></title>

</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" Namespace="">
</ext:ResourceManager>
<ext:Store ID="StoreTaglie" runat="server" >
<Model>
<ext:Model ID="Model1" runat="server" Name="taglia" IDProperty="ColDes" />
</Model>
</ext:Store>
<ext:Viewport ID="ViewportFornitori" runat="server" Layout="BorderLayout" >
<Items>
<ext:FormPanel ID="FormPanelFornitore" runat="server" ButtonAlign="Right" Cls="formMargins"
BodyPadding="5" Padding="3" Region="Center" DefaultButton="ButtonSave" Title="Fornitore..."
Layout="AnchorLayout" AnchorVertical="100%" MinWidth="300" >
<FieldDefaults LabelWidth="90" />
<Items>
<ext:FieldContainer ID="FieldContainer1" runat="server">
<FieldDefaults ReadOnly="true" />
<Items>
<ext:TextField ID="txtTaglie" runat="server" FieldLabel="Taglie" AnchorHorizontal="100%">
</ext:TextField>
<ext:TextField ID="txtColore" runat="server" FieldLabel="Colore" AnchorHorizontal="100%">
</ext:TextField>
</Items>
</ext:FieldContainer>
</Items>
<BottomBar>
<ext:Toolbar runat="server" ID="ToolBar1">
<Items>
<ext:Button ID="ButtonNew" runat="server" Text="Disable ReadOnly" Scale="Medium" IconUrl="Images/24/new24.png"
ToolTip="Load the data." ToolTipType="Title">
<DirectEvents>
<Click OnEvent="ReadOnly" />
</DirectEvents>
</ext:Button>
</Items>
</ext:Toolbar>
</BottomBar>
</ext:FormPanel>
</Items>
</ext:Viewport>

<script runat="server">

protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
txtTaglie.Text = "38,39,40,41";
txtColore.Text = "Green";
}
}

protected void ReadOnly(object sender, DirectEventArgs e)
{
FieldContainer1.FieldDefaults.ReadOnly = false;
//FieldContainer1.UpdateLayout();
}

</script>

</form>
</body>
</html>


Is possible set to readonly all the textField serverSide ?

Thanks

Aurelio

Daniil
Sep 14, 2012, 5:08 PM
Hi,

Yes, it doesn't affect when the items are already rendered.

Please iterate the Items collection and call this for each item.

item.ReadOnly = false;

Aurelio
Sep 14, 2012, 5:27 PM
HI..Daniil

Ok..

Thanks
Aurelio