PDA

View Full Version : [CLOSED] Error getting value from InnerHtml on System.Web.UI.HtmlControls.HtmlForm



jstifel
Feb 20, 2014, 6:44 PM
Hi there, why is that I am getting this error 'Error getting value from InnerHtml on System.Web.UI.HtmlControls.HtmlForm' when executing a peace of software like this:



sdr = New Ext.Net.ModelProxy(_gridstore)
For Each c As String In _gridfieldlist()
sdr.Set(c.ToUpper, PsaConvert.ObjToString(dr(c)))
Next
_gridstore.Add(sdr)



I have checked with the debugger and everything seems to be OK, although when executing the _gridstore.add(sdr) instruction I get the mentioned error.

I believe Store is not a visual web control so I cannot understand why adding row to store would raise a message like this.

geoffrey.mcgill
Feb 20, 2014, 10:26 PM
I think you're going to have to provide a simplified code sample demonstrating the whole scenario.

Here's some tips on posting to the forums and creating samples:

http://forums.ext.net/showthread.php?3440-Forum-Guidelines-For-Posting-New-Topics

http://forums.ext.net/showthread.php?10205-More-Information-Required

jstifel
Feb 21, 2014, 10:20 AM
Here goes the example code:




Imports System.Data
Imports Psa.Session
Imports Psa.Convert
Imports Psa.Data
Imports Psa.Utils.ExtNet

Imports Ext.Net

Partial Class afrespon
Inherits BasicPage

Private Property NewRecord As Boolean
Get
Return hidden_newrecord.Value = "1"
End Get
Set(value As Boolean)
hidden_newrecord.Value = IIf(value, "1", "0")
End Set
End Property

Private Property rowIndex As Integer
Get
Return IIf(hidden_rowindex.Value = "", 0, PsaConvert.ObjToInt(hidden_rowindex.Value))
End Get
Set(value As Integer)
hidden_rowindex.Value = value.ToString
End Set
End Property

Protected Overloads Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not Ext.Net.X.IsAjaxRequest Then
BindDataStore()
End If
End Sub

Protected Sub BindDataStore()
Dim sql As String = "select * from af_responsables where cmpy_code = '%1'"
sql = sql.Replace("%1", PsaSession.Cmpy)
Dim ds As DataSet = PsaData.CreateDataSet(sql)
GridPanel1.GetStore.DataSource = ds
GridPanel1.GetStore.DataBind()
End Sub

' <DirectMethod(ViewStateMode:=Ext.Net.ViewStateMode. Enabled)> _
Protected Sub ItemsCommand(sender As Object, e As DirectEventArgs)
rowIndex = e.ExtraParams("recordIndex")
Dim cmd As String = e.ExtraParams("command")
If cmd = "new" OrElse cmd = "edit" Then
If cmd = "edit" Then
Dim adata = Newtonsoft.Json.Linq.JObject.Parse(e.ExtraParams("data"))
ItemForm.SetValues(New With {.IDRESPONSABLE = adata("IDRESPONSABLE"), _
.NOMBRE = adata("NOMBRE")})
fidresponsable.ReadOnly = True
NewRecord = False
ElseIf cmd = "new" Then
ItemForm.SetValues(New With {.IDRESPONSABLE = "", _
.NOMBRE = "" _
})
fidresponsable.ReadOnly = False
NewRecord = True
End If
ItemWindow.Show()
ElseIf cmd = "delete" Then
DeleteItem(e.ExtraParams)
End If
End Sub

' <DirectMethod(ViewStateMode:=Ext.Net.ViewStateMode. Enabled)> _
Protected Sub SaveItem(ByVal sender As Object, ByVal args As DirectEventArgs)
Try
If fidresponsable.Text = "" Then
Throw New Exception("Codigo es requerido")
End If
If fnombre.Text = "" Then
Throw New Exception("Nombre es requerido")
End If
Dim sql As String
sql = "select * from af_responsables where cmpy_code = '%1' and idresponsable = '%2'"
sql = sql.Replace("%1", PsaSession.Cmpy)
sql = sql.Replace("%2", fidresponsable.Text)
Dim dt As DataTable = PsaData.CreateDataTable(sql)
Dim dr As DataRow
If NewRecord Then
If dt.Rows.Count > 0 Then
Throw New Exception("Codigo ya existe en la tabla de registros")
End If
dr = dt.NewRow
Else
dr = dt.Rows(0)
End If
utils_extnet.BindDataRowFromFormPanel(dr, ItemForm)
If newRecord Then
dt.Rows.Add(dr)
End If
dr("cmpy_code") = PsaSession.Cmpy
PsaData.UpdateTable(dr.Table, sql)
Dim sdr As Ext.Net.ModelProxy
If NewRecord Then
sdr = New Ext.Net.ModelProxy(GridPanel1.GetStore)
sdr.Set("IDRESPONSABLE", fidresponsable.Text)
sdr.Set("NOMBRE", fnombre.Text)

GridPanel1.GetStore.Add(sdr)
'GridPanel1.GetStore.Add(New With {
' .IDRESPONSABLE = fidresponsable.Text, _
' .NOMBRE = fnombre.Text _
' })
Else
sdr = GridPanel1.GetStore.GetAt(rowIndex)
sdr.Set("IDRESPONSABLE", fidresponsable.Text)
sdr.Set("NOMBRE", fnombre.Text)
sdr.Commit()
End If
Notification.Show(New NotificationConfig With {.Title = "Item", .Html = "Registro salvado"})
ItemWindow.Close()
Catch ex As Exception
args.Success = False
args.ErrorMessage = ex.Message
End Try
End Sub

Private Sub DeleteItem(ByVal Params As Ext.Net.ParameterCollection)
Dim adata = Newtonsoft.Json.Linq.JObject.Parse(Params("data"))
Dim sql As String
sql = "select count(*) from af_activos where cmpy_code = '%1' and idresponsable = '%2'"
sql = sql.Replace("%1", PsaSession.Cmpy)
sql = sql.Replace("%2", adata("IDRESPONSABLE").ToString)
Dim o As Integer = PsaConvert.ObjToInt(PsaData.ExecuteScalar(sql))
If o > 0 Then
Throw New Exception("Codigo tiene asociado activos fijos. No puede eliminar")
End If
sql = "delete from af_responsables where cmpy_code = '%1' and idresponsable = '%2'"
sql = sql.Replace("%1", PsaSession.Cmpy)
sql = sql.Replace("%2", adata("IDRESPONSABLE").ToString)
PsaData.ExecuteNonQuery(sql)
GridPanel1.GetStore.RemoveAt(rowIndex)
End Sub

End Class


the program will raise the exception at GridPanel1.GetStore.Add(sdr).
One more thing, if I try the commented code:


GridPanel1.GetStore.Add(New With {
.IDRESPONSABLE = fidresponsable.Text, _
.NOMBRE = fnombre.Text _
})
instead of
sdr = New Ext.Net.ModelProxy(GridPanel1.GetStore)
sdr.Set("IDRESPONSABLE", fidresponsable.Text)
sdr.Set("NOMBRE", fnombre.Text)

GridPanel1.GetStore.Add(sdr)

the program will work fine.

Here goes the aspx form:




<%@ Page Language="VB" MasterPageFile="~/site_no_ajax.master" AutoEventWireup="false" CodeFile="afrespon.aspx.vb" Inherits="afrespon" Title="Responsables de activos" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<extnet:ResourceManager ID="ResourceManager1" runat="server">
</extnet:ResourceManager>
<extnet:Hidden runat="server" ID="hidden_newrecord" />
<extnet:Hidden runat="server" ID="hidden_rowindex" />
<extnet:Viewport ID="Viewport1" runat="server" Layout="BorderLayout">
<Items>

<extnet:GridPanel ID="GridPanel1" runat="server" Title="Responsables de Activos"
Icon="ApplicationEdit" Layout="AnchorLayout" Flex="1" Border="false" Region="Center">
<Store>
<extnet:Store ID="GridStore" runat="server" OnReadData="BindDataStore">
<Model>
<extnet:Model ID="Model1" runat="server" IDProperty="IDRESPONSABLE">
<Fields>
<extnet:ModelField Name="IDRESPONSABLE" Type="String" />
<extnet:ModelField Name="NOMBRE" Type="String" />
</Fields>
</extnet:Model>
</Model>
</extnet:Store>

</Store>
<ColumnModel ID="ColumnModel3" runat="server">
<Columns>
<extnet:Column ID="Column3" runat="server" DataIndex="IDRESPONSABLE" Text="Codigo" Width="100" />
<extnet:Column ID="Column2" runat="server" DataIndex="NOMBRE" Text="Nombre" Flex="1" />
<extnet:ImageCommandColumn runat="server" ID="ImageCommandColumn1" Width="100">
<Commands>
<extnet:ImageCommand CommandName="edit" Icon="TableEdit" ToolTip-Text="Modificar Item" />
<extnet:ImageCommand CommandName="delete" Icon="TableDelete" ToolTip-Text="Borrar Item">
</extnet:ImageCommand>
</Commands>
<DirectEvents>
<Command OnEvent="ItemsCommand">
<ExtraParams>
<extnet:Parameter Name="command" Value="command" Mode="Raw" />
<extnet:Parameter Name="data" Value="record.data" Mode="Raw" />
<extnet:Parameter Name="recordIndex" Value="recordIndex" Mode="Raw" />
<%-- <extnet:Parameter Name="recordIndex" Value="#{GridPanel1}.store.indexOf(#{GridPanel1}.getSelec tionModel.getSelected())" Mode="Raw" />
<extnet:Parameter Name="recordIndex1" Value="#{GridPanel1}.recordIndex" Mode="Raw" />--%>
</ExtraParams>
<Confirmation Title="Confirmacion" Message="Esta seguro que desea borrar el registro?" BeforeConfirm='return (command == "delete");' ConfirmRequest="True" />
</Command>
</DirectEvents>
</extnet:ImageCommandColumn>
</Columns>
</ColumnModel>
<SelectionModel>
<extnet:RowSelectionModel ID="RowSelectionModel1" runat="server" Mode="Single">
</extnet:RowSelectionModel>
</SelectionModel>
<BottomBar>
<extnet:PagingToolbar runat="server">
<Items>
<extnet:Button runat="server" ID="btnnewitem" Text="Agregar Item" Icon="TableAdd">
<DirectEvents>
<Click OnEvent="ItemsCommand">
<ExtraParams>
<extnet:Parameter Name="command" Value="new" Mode="Value" />
</ExtraParams>
</Click>
</DirectEvents>
</extnet:Button>
</Items>
</extnet:PagingToolbar>
</BottomBar>
</extnet:GridPanel>
</Items>
</extnet:Viewport>
<extnet:Window runat="server" ID="ItemWindow" Title="Detalle del Registro" Hidden="true"
Width="800" Height="450" Layout="BorderLayout" >
<Items>
<extnet:FormPanel runat="server" ID="ItemForm" Title="Informacion" BodyPadding="5"
DefaultAnchor="100%" Region="Center">
<FieldDefaults LabelWidth="150" />
<Items>
<extnet:TextField ID="fidresponsable" runat="server" Flex="1" Width="50" FieldLabel="Codigo" Name="IDRESPONSABLE" />
<extnet:TextField ID="fnombre" runat="server" Flex="1" Width="50" FieldLabel="Nombre" Name="NOMBRE" />
</Items>
<Buttons>
<extnet:Button ID="Button9" runat="server" Text="Salvar" Icon="TableSave">
<DirectEvents>
<Click OnEvent="SaveItem">
<ExtraParams>
<extnet:Parameter Name="recordIndex" Value="#{GridPanel1}.recordIndex" Mode="Raw" />
</ExtraParams>
</Click>
</DirectEvents>
</extnet:Button>
<extnet:Button ID="Button11" runat="server" Text="Cancelar" Icon="Cancel">
<Listeners>
<Click Handler="#{ItemWindow}.close();" />
</Listeners>
</extnet:Button>
</Buttons>
</extnet:FormPanel>

</Items>

</extnet:Window>
</asp:Content>

Vladimir
Feb 21, 2014, 10:23 AM
Your example is not runable.
Please simplify it and make it runable

jstifel
Feb 21, 2014, 10:53 AM
Ok, here goes one.



<%@ Page Language="VB" AutoEventWireup="false" CodeFile="afrespon.aspx.vb" Inherits="afrespon" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>

<extnet:ResourceManager ID="ResourceManager1" runat="server">
</extnet:ResourceManager>
<extnet:Hidden runat="server" ID="hidden_newrecord" />
<extnet:Hidden runat="server" ID="hidden_rowindex" />
<extnet:Viewport ID="Viewport1" runat="server" Layout="BorderLayout">
<Items>

<extnet:GridPanel ID="GridPanel1" runat="server" Title="Responsables de Activos"
Icon="ApplicationEdit" Layout="AnchorLayout" Flex="1" Border="false" Region="Center">
<Store>
<extnet:Store ID="GridStore" runat="server" OnReadData="BindDataStore">
<Model>
<extnet:Model ID="Model1" runat="server" IDProperty="IDRESPONSABLE">
<Fields>
<extnet:ModelField Name="IDRESPONSABLE" Type="String" />
<extnet:ModelField Name="NOMBRE" Type="String" />
</Fields>
</extnet:Model>
</Model>
</extnet:Store>

</Store>
<ColumnModel ID="ColumnModel3" runat="server">
<Columns>
<extnet:Column ID="Column3" runat="server" DataIndex="IDRESPONSABLE" Text="Codigo" Width="100" />
<extnet:Column ID="Column2" runat="server" DataIndex="NOMBRE" Text="Nombre" Flex="1" />
<extnet:ImageCommandColumn runat="server" ID="ImageCommandColumn1" Width="100">
<Commands>
<extnet:ImageCommand CommandName="edit" Icon="TableEdit" ToolTip-Text="Modificar Item" />
<extnet:ImageCommand CommandName="delete" Icon="TableDelete" ToolTip-Text="Borrar Item">
</extnet:ImageCommand>
</Commands>
<DirectEvents>
<Command OnEvent="ItemsCommand">
<ExtraParams>
<extnet:Parameter Name="command" Value="command" Mode="Raw" />
<extnet:Parameter Name="data" Value="record.data" Mode="Raw" />
<extnet:Parameter Name="recordIndex" Value="recordIndex" Mode="Raw" />
<%-- <extnet:Parameter Name="recordIndex" Value="#{GridPanel1}.store.indexOf(#{GridPanel1}.getSelec tionModel.getSelected())" Mode="Raw" />
<extnet:Parameter Name="recordIndex1" Value="#{GridPanel1}.recordIndex" Mode="Raw" />--%>
</ExtraParams>
<Confirmation Title="Confirmacion" Message="Esta seguro que desea borrar el registro?" BeforeConfirm='return (command == "delete");' ConfirmRequest="True" />
</Command>
</DirectEvents>
</extnet:ImageCommandColumn>
</Columns>
</ColumnModel>
<SelectionModel>
<extnet:RowSelectionModel ID="RowSelectionModel1" runat="server" Mode="Single">
</extnet:RowSelectionModel>
</SelectionModel>
<BottomBar>
<extnet:PagingToolbar runat="server">
<Items>
<extnet:Button runat="server" ID="btnnewitem" Text="Agregar Item" Icon="TableAdd">
<DirectEvents>
<Click OnEvent="ItemsCommand">
<ExtraParams>
<extnet:Parameter Name="command" Value="new" Mode="Value" />
</ExtraParams>
</Click>
</DirectEvents>
</extnet:Button>
</Items>
</extnet:PagingToolbar>
</BottomBar>
</extnet:GridPanel>
</Items>
</extnet:Viewport>
<extnet:Window runat="server" ID="ItemWindow" Title="Detalle del Registro" Hidden="true"
Width="800" Height="450" Layout="BorderLayout" >
<Items>
<extnet:FormPanel runat="server" ID="ItemForm" Title="Informacion" BodyPadding="5"
DefaultAnchor="100%" Region="Center">
<FieldDefaults LabelWidth="150" />
<Items>
<extnet:TextField ID="fidresponsable" runat="server" Flex="1" Width="50" FieldLabel="Codigo" Name="IDRESPONSABLE" />
<extnet:TextField ID="fnombre" runat="server" Flex="1" Width="50" FieldLabel="Nombre" Name="NOMBRE" />
</Items>
<Buttons>
<extnet:Button ID="Button9" runat="server" Text="Salvar" Icon="TableSave">
<DirectEvents>
<Click OnEvent="SaveItem">
<ExtraParams>
<extnet:Parameter Name="recordIndex" Value="#{GridPanel1}.recordIndex" Mode="Raw" />
</ExtraParams>
</Click>
</DirectEvents>
</extnet:Button>
<extnet:Button ID="Button11" runat="server" Text="Cancelar" Icon="Cancel">
<Listeners>
<Click Handler="#{ItemWindow}.close();" />
</Listeners>
</extnet:Button>
</Buttons>
</extnet:FormPanel>

</Items>

</extnet:Window>
</div>
</form>
</body>
</html>





Imports System.Data

Imports Ext.Net

Partial Class afrespon
Inherits System.Web.UI.Page

Private Property NewRecord As Boolean
Get
Return hidden_newrecord.Value = "1"
End Get
Set(value As Boolean)
hidden_newrecord.Value = IIf(value, "1", "0")
End Set
End Property

Private Property rowIndex As Integer
Get
If hidden_rowindex.Value Is Nothing OrElse hidden_rowindex.Value = "" Then
Return 0
Else
Return hidden_rowindex.Value
End If
Return 0
End Get
Set(value As Integer)
hidden_rowindex.Value = value.ToString
End Set
End Property

Protected Overloads Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not Ext.Net.X.IsAjaxRequest Then
BindDataStore()
End If
End Sub

Protected Sub BindDataStore()
Dim dt As DataTable = New DataTable
dt.Columns.Add("IDRESPONSABLE", Type.GetType("System.String"))
dt.Columns.Add("NOMBRE", Type.GetType("System.String"))
Dim dr As DataRow
dr = dt.NewRow
dr("IDRESPONSABLE") = "A"
dr("NOMBRE") = "AA"
dt.Rows.Add(dr)
dr = dt.NewRow
dr("IDRESPONSABLE") = "B"
dr("NOMBRE") = "BB"
dt.Rows.Add(dr)
GridPanel1.GetStore.DataSource = dt
GridPanel1.GetStore.DataBind()
End Sub

' <DirectMethod(ViewStateMode:=Ext.Net.ViewStateMode. Enabled)> _
Protected Sub ItemsCommand(sender As Object, e As DirectEventArgs)
rowIndex = e.ExtraParams("recordIndex")
Dim cmd As String = e.ExtraParams("command")
If cmd = "new" OrElse cmd = "edit" Then
If cmd = "edit" Then
Dim adata = Newtonsoft.Json.Linq.JObject.Parse(e.ExtraParams("data"))
ItemForm.SetValues(New With {.IDRESPONSABLE = adata("IDRESPONSABLE"), _
.NOMBRE = adata("NOMBRE")})
fidresponsable.ReadOnly = True
NewRecord = False
ElseIf cmd = "new" Then
ItemForm.SetValues(New With {.IDRESPONSABLE = "", _
.NOMBRE = "" _
})
fidresponsable.ReadOnly = False
NewRecord = True
End If
ItemWindow.Show()
ElseIf cmd = "delete" Then
DeleteItem(e.ExtraParams)
End If
End Sub

' <DirectMethod(ViewStateMode:=Ext.Net.ViewStateMode. Enabled)> _
Protected Sub SaveItem(ByVal sender As Object, ByVal args As DirectEventArgs)
Try
If fidresponsable.Text = "" Then
Throw New Exception("Codigo es requerido")
End If
If fnombre.Text = "" Then
Throw New Exception("Nombre es requerido")
End If
Dim sdr As Ext.Net.ModelProxy
If NewRecord Then
sdr = New Ext.Net.ModelProxy(GridPanel1.GetStore)
sdr.Set("IDRESPONSABLE", fidresponsable.Text)
sdr.Set("NOMBRE", fnombre.Text)

GridPanel1.GetStore.Add(sdr)
'GridPanel1.GetStore.Add(New With {
' .IDRESPONSABLE = fidresponsable.Text, _
' .NOMBRE = fnombre.Text _
' })
Else
sdr = GridPanel1.GetStore.GetAt(rowIndex)
sdr.Set("IDRESPONSABLE", fidresponsable.Text)
sdr.Set("NOMBRE", fnombre.Text)
sdr.Commit()
End If
Notification.Show(New NotificationConfig With {.Title = "Item", .Html = "Registro salvado"})
ItemWindow.Close()
Catch ex As Exception
args.Success = False
args.ErrorMessage = ex.Message
End Try
End Sub

Private Sub DeleteItem(ByVal Params As Ext.Net.ParameterCollection)
End Sub

End Class

Daniil
Feb 21, 2014, 11:19 AM
Thank you.

I cannot reproduce the problem.

What are the steps?

- Click "Agregar item"
- Fill both the fields
- Click "Salvar"

After that some records are added to the GridPanel and I don't see any error.

What Ext.NET version are you using?

Also please post the full stack trace of the Exception and exact Exception message.

P.S. For posting samples on the forums it is better to put the code behind directly to the ASPX page wrapping in <script runat="server">.

jstifel
Feb 21, 2014, 11:26 AM
Yes, that is the procedure.

Here goes full error code:


Server Error in '/emax' Application.

Cannot get inner content of form1 because the contents are not literal.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Cannot get inner content of form1 because the contents are not literal.

Source Error:



Line 90: sdr.Set("NOMBRE", fnombre.Text)
Line 91:
Line 92: GridPanel1.GetStore.Add(sdr)
Line 93: 'Dim store As Ext.Net.Store = New Ext.Net.Store()
Line 94: 'GridPanel1.GetStore.Add(New With {


Source File: C:\maximise\websites\emax\temp\afrespon.aspx.vb Line: 92

Stack Trace:



[HttpException (0x80004005): Cannot get inner content of form1 because the contents are not literal.]
System.Web.UI.HtmlControls.HtmlContainerControl.ge t_InnerHtml() +3154608
GetInnerHtml(Object ) +40
Newtonsoft.Json.Serialization.DynamicValueProvider .GetValue(Object target) +133

[JsonSerializationException: Error getting value from 'InnerHtml' on 'System.Web.UI.HtmlControls.HtmlForm'.]
Newtonsoft.Json.Serialization.DynamicValueProvider .GetValue(Object target) +267
Newtonsoft.Json.Serialization.JsonSerializerIntern alWriter.CalculatePropertyValues(JsonWriter writer, Object value, JsonContainerContract contract, JsonProperty member, JsonProperty property, JsonContract& memberContract, Object& memberValue) +305
Newtonsoft.Json.Serialization.JsonSerializerIntern alWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) +491
Newtonsoft.Json.Serialization.JsonSerializerIntern alWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty) +467
Newtonsoft.Json.Serialization.JsonSerializerIntern alWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) +491
Newtonsoft.Json.Serialization.JsonSerializerIntern alWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty) +467
Newtonsoft.Json.Serialization.JsonSerializerIntern alWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) +491
Newtonsoft.Json.Serialization.JsonSerializerIntern alWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty) +467
Newtonsoft.Json.Serialization.JsonSerializerIntern alWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) +635
Newtonsoft.Json.Serialization.JsonSerializerIntern alWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty) +574
Newtonsoft.Json.Serialization.JsonSerializerIntern alWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) +491
Newtonsoft.Json.Serialization.JsonSerializerIntern alWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty) +467
Newtonsoft.Json.Serialization.JsonSerializerIntern alWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) +635
Newtonsoft.Json.Serialization.JsonSerializerIntern alWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty) +574
Newtonsoft.Json.Serialization.JsonSerializerIntern alWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) +491
Newtonsoft.Json.Serialization.JsonSerializerIntern alWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty) +467
Newtonsoft.Json.Serialization.JsonSerializerIntern alWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) +491
Newtonsoft.Json.Serialization.JsonSerializerIntern alWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty) +467
Newtonsoft.Json.Serialization.JsonSerializerIntern alWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType) +216
Newtonsoft.Json.JsonSerializer.SerializeInternal(J sonWriter jsonWriter, Object value, Type objectType) +2066
Newtonsoft.Json.JsonSerializer.Serialize(JsonWrite r jsonWriter, Object value, Type objectType) +45
Newtonsoft.Json.JsonConvert.SerializeObject(Object value, Type type, Formatting formatting, JsonSerializerSettings settings) +225
Newtonsoft.Json.JsonConvert.SerializeObject(Object value, Formatting formatting, JsonSerializerSettings settings) +47
Newtonsoft.Json.JsonConvert.SerializeObject(Object value, JsonSerializerSettings settings) +44
Ext.Net.JSON.Serialize(Object obj, JsonSerializerSettings settings) +237
Ext.Net.JSON.Serialize(Object obj, IList`1 converters, IContractResolver resolver) +137
Ext.Net.JSON.Serialize(Object obj) +40
Ext.Net.JRawValue.ToString() +212
Ext.Net.JRawValueJsonConverter.WriteJson(JsonWrite r writer, Object value, JsonSerializer serializer) +61
Newtonsoft.Json.Serialization.JsonSerializerIntern alWriter.SerializeConvertable(JsonWriter writer, JsonConverter converter, Object value, JsonContract contract, JsonContainerContract collectionContract, JsonProperty containerProperty) +399
Newtonsoft.Json.Serialization.JsonSerializerIntern alWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty) +365
Newtonsoft.Json.Serialization.JsonSerializerIntern alWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType) +216
Newtonsoft.Json.JsonSerializer.SerializeInternal(J sonWriter jsonWriter, Object value, Type objectType) +2066
Newtonsoft.Json.JsonSerializer.Serialize(JsonWrite r jsonWriter, Object value, Type objectType) +45
Newtonsoft.Json.JsonConvert.SerializeObject(Object value, Type type, Formatting formatting, JsonSerializerSettings settings) +225
Newtonsoft.Json.JsonConvert.SerializeObject(Object value, Formatting formatting, JsonSerializerSettings settings) +47
Newtonsoft.Json.JsonConvert.SerializeObject(Object value, JsonSerializerSettings settings) +44
Ext.Net.JSON.Serialize(Object obj, JsonSerializerSettings settings) +237
Ext.Net.JSON.Serialize(Object obj, IList`1 converters, IContractResolver resolver) +137
Ext.Net.JSON.Serialize(Object obj, IList`1 converters) +43
Ext.Net.BaseControl.CallTemplate(ScriptPosition position, String template, String name, Object[] args) +367
Ext.Net.BaseControl.Call(ScriptPosition mode, String name, Object[] args) +54
Ext.Net.BaseControl.Call(String name, Object[] args) +50
Ext.Net.StoreBase.Add(ModelProxy model) +144
afrespon.SaveItem(Object sender, DirectEventArgs args) in C:\maximise\websites\emax\temp\afrespon.aspx.vb:92
Ext.Net.ComponentDirectEvent.OnEvent(DirectEventAr gs e) +79
Ext.Net.Observable.FireAsyncEvent(String eventName, ParameterCollection extraParams) +688
Ext.Net.ResourceManager.RaisePostBackEvent(String eventArgument) +1950
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +9646822
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724




Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18067

jstifel
Feb 21, 2014, 11:34 AM
I am using ext.net 2.4.0, .net 4.0.

Vladimir
Feb 21, 2014, 12:11 PM
I cannot reproduce the issue also
In any way, the following code is incorrect


sdr = New Ext.Net.ModelProxy(GridPanel1.GetStore)
sdr.Set("IDRESPONSABLE", fidresponsable.Text)
sdr.Set("NOMBRE", fnombre.Text)

GridPanel1.GetStore.Add(sdr)


ModelProxy class must be used for existing records only. ModelProxy constructor with store means that need to handle all records in the store. Your code update IDRESPONSABLE and NOMBRE fields for all records (set the same value), after that reinsert all records

To insert new record just use the code which is commented in SaveItem


GridPanel1.GetStore.Add(New With {
.IDRESPONSABLE = fidresponsable.Text, _
.NOMBRE = fnombre.Text _
})

jstifel
Feb 21, 2014, 12:30 PM
Yes, if I use 'New With' it works. My problem is I cannot use this syntax because I need to be able to assign column values to row data by referencing column name before I add it to store. This because I am building a control that dynamically creates data-entry forms based on JSON file description so I cannot hard code columns names in code.

Is it there any way to do this by using New With?
Can I pass a different type of object to method Add, like a JSON object?

Vladimir
Feb 21, 2014, 12:52 PM
Use Dictionary instead anonymous object

jstifel
Feb 21, 2014, 1:13 PM
Any example on how passing the dictionary to Add method?

jstifel
Feb 21, 2014, 1:15 PM
Never mind. I already got it.
Let you know if everything Ok.

jstifel
Feb 21, 2014, 2:18 PM
OK, it worked perfect.
Thanks a lot.
Please close the case.