May 09, 2014, 10:56 PM
rendering error: using DatePickerControl "DateFieldFor " in partial view
I have a view "called:edit" that contain a partial view "called:CreateDialog" as following
Edit View
when I request the partial view, it is rendered fine. but when request the main view "Edit" , it yhrow js exception and page doesn't render correctly
JS Exception
Edit View
<div id="divCreate" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="padding-top:50px">
<div class=" modal-dialog">
<div class="modal-content">
<div class="modal-header alert alert-warning">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">?</button>
<h4 class="modal-title" id="myModalLabel">Create Action</h4>
</div>
<div class="modal-body">
@Html.Action("CreateDialog", "DiscussionAction", new { id = Model.DiscussionID })
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button id="btnClearConditions" type="button" class="btn btn-primary" onclick="SaveAction('frmCreateAction')">Save</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
CreateDialog partial view<div class="form-group">
<div class="input-group">
@Html.LabelFor(model => model.Description, new { @class = "input-group-addon label-width" })
@Html.TextAreaFor(model => model.Description, new { @class = "form-control ctrl-width" })
@Html.ValidationMessageFor(model => model.Description)
</div>
</div>
<div class="form-group">
<div class="input-group">
@Html.LabelFor(model => model.DueDate, new { @class = "input-group-addon label-width" })
@Html.X().DateFieldFor(model => model.DueDate).ID("dtDueDate").Icon(Icon.DateMagnify).Editable(true).Format("MM/dd/yyyy").HideLabel(true).Cls("input-group-addon label-width")
@Html.ValidationMessageFor(model => model.DueDate)
</div>
</div>
the partial view has "DateFieldFor" component that render datepicker . when I request the partial view, it is rendered fine. but when request the main view "Edit" , it yhrow js exception and page doesn't render correctly
JS Exception
Message: 'X' is undefined
Line: 2026
Char: 13
Code: 0
URI: http://localhost:53620/extnet/extnet-all-debug-js/ext.axd?v=25065
Ext.override(Ext.Component, {
initComponent : function () {
this.callParent(arguments);
if (!Ext.isEmpty(this.contextMenuId, false)) {
this.on("render", function () {
this.mon(this.el, "contextmenu", function (e, t) {
var menu = Ext.menu.MenuMgr.get(this.contextMenuId);
menu.contextEvent = { e : e, t : t };
e.stopEvent();
e.preventDefault();
menu.showAt(e.getXY());
}, this);
}, this, { single : true });
}
if (this.iconCls) {
X.net.RM.setIconCls(this, "iconCls");
}