Jul 22, 2010, 6:30 PM
[CLOSED] Form control values are not updated during DirectEvent
I am trying to retrieve the value from a drop-down list within a DirectEvent handler. Am I doing something incorrectly, or is this maybe a feature that hasn't been implemented?
I have legacy code that I need to mix with Coolite controls, so I'm trying to replace UpdatePanels with this mechanism.
The sample below demonstrates the issue:
I have legacy code that I need to mix with Coolite controls, so I'm trying to replace UpdatePanels with this mechanism.
The sample below demonstrates the issue:
<%@ Page Language="C#" AutoEventWireup="true" %>
<!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>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack || X.IsAjaxRequest)
{
ddlTemplates.DataSource = new object[] {
new { Name = "Template A", ID=1 },
new { Name = "Template B", ID=2 }
};
ddlTemplates.DataBind();
}
}
protected void btnApplyTemplate_Click(object sender, Ext.Net.DirectEventArgs e)
{
string templateID = ddlTemplates.SelectedValue;
X.Msg.Notify("Status", "You selected: " + ddlTemplates.SelectedItem.Text).Show();
lblTemplateName.Text = "I am using template " + templateID;
lblTemplateName.Update();
}
</script>
<form id="form1" runat="server">
<div>
<ext:ResourceManager ID="extManager" runat="server" IDMode="Static">
<CustomDirectEvents>
<ext:DirectEvent Target="btnApplyTemplate" OnEvent="btnApplyTemplate_Click">
<EventMask ShowMask="true" Msg="Working..." />
</ext:DirectEvent>
</CustomDirectEvents>
</ext:ResourceManager>
<asp:DropDownList ID="ddlTemplates" runat="server" DataTextField="Name" DataValueField="ID" />
<br />
<asp:Button runat="server" ID="btnApplyTemplate" Text="Apply" />
<br /><br />
<asp:Label ID="lblTemplateName" runat="server" />
</div>
</form>
</body>
</html>
Last edited by geoffrey.mcgill; Jul 26, 2010 at 7:02 AM.