Aug 04, 2012, 10:39 PM
Direct Events with Razor
Hi All,
The original working code looked like this:
In razor, I am attempting to package it up like this:
The original working code looked like this:
<ext:Button ID="btnDelete" runat="server" Text="Delete" Icon="Cross">
<DirectEvents>
<Click
Url="/Data/DeleteBankAccount"
CleanRequest="true"
Method="POST"
Failure="Ext.Msg.show({title:'Delete Error',msg: result.errorMessage,buttons: Ext.Msg.OK,icon: Ext.Msg.ERROR});"
Success="txtBankAccounts.lastQuery=null; bankAccountChanged = true;#{BankAccountPager}.doLoad(Math.max(0, #{BankAccountPager}.cursor-1));">
<Confirmation ConfirmRequest="true" Title="Alert" Message="Delete Record?" />
<ExtraParams>
<ext:Parameter Name="accountID" Value="#{dsBankAccountInstance}.getAt(0).AccountID" Mode="Raw" />
</ExtraParams>
</Click>
</DirectEvents>
</ext:Button>
Problem:In razor, I am attempting to package it up like this:
items.Add(Html.X().Button().ID("btnDelete").Text("Delete").Icon(Icon.Cross)
.DirectEvents(directEvents => {
<Click
.Url="/Data/DeleteBankAccount"
CleanRequest=true
Method="POST"
Failure="Ext.Msg.show({title:'Delete Error',msg: result.errorMessage,buttons: Ext.Msg.OK,icon: Ext.Msg.ERROR});"
Success="txtBankAccounts.lastQuery=null; bankAccountChanged = true;#{BankAccountPager}.doLoad(Math.max(0, #{BankAccountPager}.cursor-1));">
<Confirmation ConfirmRequest=true Title("Alert" Message="Delete Record?));
.ExtraParams(extraParams => {
parameters.Add(Html.X().Parameter().Name("accountID").Value("#{dsBankAccountInstance}.getAt(0).AccountID").Mode(ParameterMode.Raw));
})
</Click>
})
);
How do I package up the <Click handler. Intelllisense doesn't see a directEvents.Click property. Along with this, how will I package up the parameters. The example that was given in the Forum was simple. It just had a Url. How about the rest of the Click parameters. Do I treat each one as an extra parameter?
Last edited by Daniil; Aug 06, 2012 at 9:40 AM.
Reason: Please use [CODE] tags