Aug 20, 2012, 8:16 PM
What is MVC - AjaxStoreResult.cs replacement Ext 2.0
What is the replacement for the following class for MVC project using ext 2.0? If comment out lines with ConfirmationList and use this I am getting
error "Uncaught TypeError: Cannot read property 'internalid' of undefined ext.asd line 18"
public class AjaxStoreResult : ActionResult
{
private object _data;
private int _total;
private StoreResponseFormat responseFormat = StoreResponseFormat.Load;
private SaveStoreResponse saveResponse;
#region Constructor(s)
public AjaxStoreResult() { }
public AjaxStoreResult(object data)
{
this.Data = data;
}
public AjaxStoreResult(object data, int totalCount) : this(data)
{
this.Total = totalCount;
}
public AjaxStoreResult(StoreResponseFormat responseFormat)
{
this.ResponseFormat = responseFormat;
}
#endregion
public object Data
{
get { return this._data; }
set { this._data = value; }
}
public int Total
{
get { return this._total; }
set { this._total = value; }
}
public StoreResponseFormat ResponseFormat
{
get { return this.responseFormat; }
set { this.responseFormat = value; }
}
public SaveStoreResponse SaveResponse
{
get
{
if(this.saveResponse == null)
{
this.saveResponse = new SaveStoreResponse();
}
return this.saveResponse;
}
}
public override void ExecuteResult(ControllerContext context)
{
switch (this.ResponseFormat)
{
case StoreResponseFormat.Load:
StoreResponseData storeResponse = new StoreResponseData();
storeResponse.Data = JSON.Serialize(this.Data);
storeResponse.Total = this.Total;
storeResponse.Return();
break;
case StoreResponseFormat.Save:
Response response = new Response(true);
response.Success = this.SaveResponse.Success;
response.Message = this.SaveResponse.Message;
StoreResponseData saveResponse = new StoreResponseData();
saveResponse.Confirmation = this.SaveResponse.ConfirmationList;
saveResponse= this.SaveResponse;
response.Data = saveResponse.ToString();
response.Return();
break;
default:
throw new ArgumentOutOfRangeException();
}
}
}
public enum StoreResponseFormat
{
Load,
Save
}
public class SaveStoreResponse
{
private bool success = true;
private string message;
public bool Success
{
get { return this.success; }
set { this.success = value; }
}
public string Message
{
get { return this.message; }
set { this.message = value; }
}
public ConfirmationList ConfirmationList { get; set; }
}
error "Uncaught TypeError: Cannot read property 'internalid' of undefined ext.asd line 18"
public class AjaxStoreResult : ActionResult
{
private object _data;
private int _total;
private StoreResponseFormat responseFormat = StoreResponseFormat.Load;
private SaveStoreResponse saveResponse;
#region Constructor(s)
public AjaxStoreResult() { }
public AjaxStoreResult(object data)
{
this.Data = data;
}
public AjaxStoreResult(object data, int totalCount) : this(data)
{
this.Total = totalCount;
}
public AjaxStoreResult(StoreResponseFormat responseFormat)
{
this.ResponseFormat = responseFormat;
}
#endregion
public object Data
{
get { return this._data; }
set { this._data = value; }
}
public int Total
{
get { return this._total; }
set { this._total = value; }
}
public StoreResponseFormat ResponseFormat
{
get { return this.responseFormat; }
set { this.responseFormat = value; }
}
public SaveStoreResponse SaveResponse
{
get
{
if(this.saveResponse == null)
{
this.saveResponse = new SaveStoreResponse();
}
return this.saveResponse;
}
}
public override void ExecuteResult(ControllerContext context)
{
switch (this.ResponseFormat)
{
case StoreResponseFormat.Load:
StoreResponseData storeResponse = new StoreResponseData();
storeResponse.Data = JSON.Serialize(this.Data);
storeResponse.Total = this.Total;
storeResponse.Return();
break;
case StoreResponseFormat.Save:
Response response = new Response(true);
response.Success = this.SaveResponse.Success;
response.Message = this.SaveResponse.Message;
StoreResponseData saveResponse = new StoreResponseData();
saveResponse.Confirmation = this.SaveResponse.ConfirmationList;
saveResponse= this.SaveResponse;
response.Data = saveResponse.ToString();
response.Return();
break;
default:
throw new ArgumentOutOfRangeException();
}
}
}
public enum StoreResponseFormat
{
Load,
Save
}
public class SaveStoreResponse
{
private bool success = true;
private string message;
public bool Success
{
get { return this.success; }
set { this.success = value; }
}
public string Message
{
get { return this.message; }
set { this.message = value; }
}
public ConfirmationList ConfirmationList { get; set; }
}
Last edited by dpk; Aug 20, 2012 at 8:19 PM.