Nov 18, 2015, 5:53 AM
[CLOSED] Help in migrate this case from webform into MVC
Can you help me how to migrate this "webform" case into "mvc"?
a) In which event (controller) can I load the initial content of Combobox "cmbZ".
b) I need when I click the Button "btnB" the "labels" being updated. At this moment, the labels are in the webform "runat" format. Can you help with the controller.
a) In which event (controller) can I load the initial content of Combobox "cmbZ".
b) I need when I click the Button "btnB" the "labels" being updated. At this moment, the labels are in the webform "runat" format. Can you help with the controller.
<ul class="list-unstyled">
<li><strong>Ubicación:</strong> <ext:Label Id="lUbi" runat="server" /></li>
<li><strong>Director:</strong> <ext:Label Id="lDir" runat="server" /></li>
<li><strong>Administrador:</strong> <ext:Label Id="lAdm" runat="server" /></li>
</ul>
@model System.Collections.IEnumerable
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}
@section extnetsection {
@Html.X().ResourceManager()
}
<div class="breadcrumbs">
<div class="container">
<h1 class="pull-left">Directorio Unidad/Teléfono</h1>
<ul class="pull-right breadcrumb">
<li><a href='@Url.Action("Index", "Home", new { area = "Comun" })'>inicio</a></li>
<li class="active">directorio</li>
</ul>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-sm-2 md-margin-bottom-10">
@(Html.X().ComboBox()
.ID("cmbZ")
.Editable(false)
.DisplayField("Descripcion")
.ValueField("Id")
.QueryMode(DataLoadMode.Local)
.TriggerAction(TriggerAction.All)
.EmptyText("Zona")
.Listeners(ls =>
ls.Select.Handler = "#{cmbU}.clearValue(); #{stU}.reload(); #{grdD}.getStore().removeAll();#{lUbi}.setText('');#{lDir}.setText('');#{lAdm}.setText('');"
)
.Store(Html.X.Store()
.Model(Html.X.Model()
.Fields(Html.X.ModelField().Name("Id").Type(ModelFieldType.String),
Html.X.ModelField().Name("Descripcion").Type(ModelFieldType.String)
)
)
.Listeners(ls =>
ls.Load.Handler = "if(#{cmbZ}.store.getCount() > 1){#{cmbZ}.setValue(#{cmbZ}.store.getAt(0).get('Id')); #{cmbU}.getStore().reload(); #{grdD}.getStore().removeAll();#{lUbi}.setText('');#{lDir}.setText('');#{lAdm}.setText(''); };"
)
)
)
</div>
<div class="col-sm-2 md-margin-bottom-10">
@(Html.X().ComboBox()
.ID("cmbU")
.TypeAhead(true)
.QueryMode(DataLoadMode.Local)
.ForceSelection(true)
.TriggerAction(TriggerAction.All)
.DisplayField("Nombre")
.ValueField("Id")
.EmptyText("Unidades...")
.ValueNotFoundText("Unidades...")
.Listeners(ls =>
ls.Select.Handler = "#{btnB}.enable(); #{grdD}.getStore().removeAll();#{lUbi}.setText('');#{lDir}.setText('');#{lAdm}.setText('');"
)
.Store(Html.X.Store()
.ID("stU")
.AutoLoad(false)
.Model(Html.X.Model()
.IDProperty("Id")
.Fields(Html.X.ModelField().Name("Id").Type(ModelFieldType.String),
Html.X.ModelField().Name("Nombre").Type(ModelFieldType.String)
)
)
.Proxy(Html.X().AjaxProxy()
.Url(Url.Action("UnidadRefresh", "Directorio", new { area = "Comun" }))
.Reader(Html.X().JsonReader().RootProperty("data"))
)
.Parameters(ps =>
ps.Add(new StoreParameter("zonaid", "#{cmbZ}.getValue()", ParameterMode.Raw))
)
.Listeners(ls =>
ls.Load.Handler = "if(#{cmbU}.store.getCount() > 1) {#{cmbU}.setValue(#{cmbU}.store.getAt(0).get('Id'));#{cmbU}.enable();} else {#{cmbU}.disable();#{btnB}.disable();} #{grdD}.getStore().removeAll();#{lUbi}.setText('');#{lDir}.setText('');#{lAdm}.setText('');"
)
)
)
</div>
<div class="col-sm-2 md-margin-bottom-10">
@(Html.X().Button()
.ID("btnB")
.Text("Buscar")
.Icon(Icon.Magnifier)
.Disabled(true)
.LoadingState(new ButtonLoadingState() { Text = "Espere..." })
.DirectEvents(de => {
de.Click.Action = Url.Action("GetUnidad", "Directorio", new { area = "Comun" });
de.Click.Failure = "Ext.MessageBox.alert('Error', 'Error Buscando Informacion. Intente de Nuevo.');";
de.Click.EventMask.ShowMask = true;
de.Click.EventMask.Target = MaskTarget.CustomTarget;
de.Click.EventMask.CustomTarget = "#{grdD}";
}
)
)
</div>
</div>
<div class="row height-350 margin-top-20">
<div class="col-sm-3 md-margin-bottom-10">
<h3>Información</h3>
<ul class="list-unstyled">
<li><strong>Ubicación:</strong> <ext:Label Id="lUbi" runat="server" /></li>
<li><strong>Director:</strong> <ext:Label Id="lDir" runat="server" /></li>
<li><strong>Administrador:</strong> <ext:Label Id="lAdm" runat="server" /></li>
</ul>
</div>
<div class="col-sm-7 md-margin-bottom-10">
@(Html.X().GridPanel()
.ID("grdD")
.Width(600)
.Height(300)
.Store(Html.X().Store()
.ID("st01")
.Model(Html.X().Model()
.Fields(
new ModelField("Area"),
new ModelField("Telefono"),
new ModelField("Comentario")
)
)
.DataSource(Model)
)
.ColumnModel(
Html.X().Column().ID("AreaColumn").Text("Area").DataIndex("Area").Flex(1),
Html.X().Column().ID("TelefonoColumn").Text("Telefono").DataIndex("Telefono"),
Html.X().Column().ID("ComentarioColumn").Text("Comentario").DataIndex("Comentario")
)
.View(Html.X().GridView().TrackOver(true).StripeRows(true))
)
</div>
</div>
</div>
Thanks in advance, being honest I'm coming into the MVC ext.net, any help is welcomed.
Last edited by Daniil; Nov 25, 2015 at 4:13 PM.
Reason: [CLOSED]