Nov 05, 2014, 12:48 PM
[CLOSED] Ext:Hidden value
What basic issue am I missing/overlooking in the example below? Perform the following:
When the hidden value is set I was hoping it would always be a Boolean.
- Launch page and inspect App.SampleHidden.value (Undefined - GOOD)
- Press the "DOIT" button and inspect App.SampleHidden.value ("true" - BAD, I was expecting a boolean and not a string;
- Press the browsers refresh button and inspect App.SampleHidden.value (true - GOOD)
When the hidden value is set I was hoping it would always be a Boolean.
<%@ Page Language="C#" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html>
<html>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (X.IsAjaxRequest) return;
SetHidden();
}
protected void Doit(object sender, DirectEventArgs e)
{
Session["ABC"] = "Set";
SetHidden();
}
private void SetHidden()
{
if (Session["ABC"] == null) return;
SampleHidden.SetValue(Convert.ToBoolean("true"));
}
</script>
<head runat="server">
<title></title>
<style type="text/css">
</style>
<script type="text/javascript">
</script>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:Panel runat="server">
<Bin>
<ext:Hidden ID="SampleHidden" runat="server" ClientIDMode="Static" />
</Bin>
<Items>
<ext:Button runat="server" Text="DOIT" OnDirectClick="Doit" />
</Items>
</ext:Panel>
</form>
</body>
</html>
Last edited by Daniil; Nov 05, 2014 at 6:32 PM.
Reason: [CLOSED]