Sep 09, 2013, 6:50 PM
[CLOSED] How to name ExtraParams dynamically in markup?
Hi,
Please suggest how to correctly name ExtraParams in the markup dynamically. Here's the code sample I'm trying to work with:
Please suggest how to correctly name ExtraParams in the markup dynamically. Here's the code sample I'm trying to work with:
<%@ Page Language="C#" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script runat="server">
const string Const1 = "Constant1";
const string Const2 = "Constant2";
protected void Page_Load(object sender, EventArgs e)
{
if (X.IsAjaxRequest) return;
}
protected void ButtonSave_Click(object sender, DirectEventArgs e)
{
var param1 = e.ExtraParams[Const1];
var param2 = e.ExtraParams[Const2];
}
</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 id="Head1" runat="server">
<title>Ext.NET Examples</title>
<ext:ResourcePlaceHolder ID="ResourcePlaceHolder1" runat="server" Mode="Script" />
<ext:ResourcePlaceHolder ID="ResourcePlaceHolder2" runat="server" Mode="Style" />
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Panel ID="Panel1" runat="server" Width="800" Height="600">
<Items>
<ext:BorderLayout ID="BorderLayout1" runat="server">
<Center>
<ext:FormPanel ID="FormPanel1" runat="server" Title="Form Panel" Padding="5" ButtonAlign="Right"
TrackResetOnLoad="true">
<Items>
<ext:TextField ID="CompanyField" DataIndex="company" runat="server" FieldLabel="Company"
AnchorHorizontal="95%" />
<ext:TextField ID="PriceField" DataIndex="price" runat="server" FieldLabel="Price"
AnchorHorizontal="95%" />
<ext:TextField ID="ChangeField" DataIndex="change" runat="server" FieldLabel="Change"
AnchorHorizontal="95%" />
<ext:TextField ID="PctChangeField" DataIndex="pctChange" runat="server" FieldLabel="Change (%)"
AnchorHorizontal="95%" />
<ext:DateField ID="lastChange" runat="server" FieldLabel="Last Updated" AnchorHorizontal="95%" />
</Items>
<Buttons>
<ext:Button runat="server" ID="ButtonSave" Text="Save">
<DirectEvents>
<Click OnEvent="ButtonSave_Click" Success="Ext.Msg.alert('Prompt', 'Success!');">
<EventMask ShowMask="true" />
<ExtraParams>
<ext:Parameter Name="<%# Const1 %>" Value="1" Mode="Raw" />
<ext:Parameter Name="<%# Const2 %>" Value="2" Mode="Raw" />
</ExtraParams>
</Click>
</DirectEvents>
</ext:Button>
</Buttons>
</ext:FormPanel>
</Center>
</ext:BorderLayout>
</Items>
</ext:Panel>
</form>
</body>
</html>
Last edited by geoffrey.mcgill; Sep 10, 2013 at 3:57 AM.
Reason: [CLOSED]