Sep 14, 2012, 1:35 PM
PropertyGrid Source empty on direct submit
We have a PropertyGrid that is filled on Page Load.
When we edit a property before submitting we get all properties back.
But when we submit it directly the PropertyGrid.Source is empty.
Browsers : IE8 IE9 Chrome
ExtNet : 1.5.0 4225
.NET Framework 4.0
Visual Studio 2010
When we edit a property before submitting we get all properties back.
But when we submit it directly the PropertyGrid.Source is empty.
Browsers : IE8 IE9 Chrome
ExtNet : 1.5.0 4225
.NET Framework 4.0
Visual Studio 2010
<%@ Page Language="C#" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (ExtNet.IsAjaxRequest || IsPostBack) return;
var data = new List<Tuple<string, decimal>>
{
new Tuple<string, decimal>("BlaBla", 123.343m),
new Tuple<string, decimal>("AlbAlb", 43.234m),
new Tuple<string, decimal>("aaaa", 6845.8484m),
new Tuple<string, decimal>("bbbb", 48.58m),
new Tuple<string, decimal>("cccc", 4698.45m)
};
foreach (Tuple<string, decimal> parameter in data)
{
var param = new PropertyGridParameter(
new PropertyGridParameter.Config
{
Name = parameter.Item1,
DisplayName = parameter.Item1,
Value = parameter.Item2.ToString(),
Editor = { new NumberField { StyleSpec = "text-align:left", DecimalSeparator = ",", DecimalPrecision = 5, AllowDecimals = true } },
});
param.Renderer.Handler = string.Format("return Ext.util.Format.number(value, '{0}');", "0.000,00000/i");
pgBlaBlaValues.Source.Add(param);
}
}
protected void SubmitPg(object sender, DirectEventArgs e)
{
taResult.Clear();
foreach (PropertyGridParameter parameter in pgBlaBlaValues.Source)
{
taResult.Text += string.Format("{0} - {1}{2}", parameter.Name, parameter.Value, Environment.NewLine);
}
if (string.IsNullOrEmpty(taResult.Text))
taResult.Text = @"Got no properties back (T_T)";
}
</script>
<!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>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager runat="server" />
<ext:Viewport runat="server" Layout="FitLayout">
<Items>
<ext:Panel runat="server" Layout="RowLayout">
<Items>
<ext:PropertyGrid runat="server" ID="pgBlaBlaValues" RowHeight="0.5" />
<ext:TextArea runat="server" ID="taResult" RowHeight="0.5" />
</Items>
<Buttons>
<ext:Button runat="server" ID="Submit" Text="Submit">
<DirectEvents>
<Click OnEvent="SubmitPg" />
</DirectEvents>
</ext:Button>
</Buttons>
</ext:Panel>
</Items>
</ext:Viewport>
</form>
</body>
</html>