Oct 09, 2011, 9:38 AM
How to get TreePanel selected node from Code Behind?
I search for the discuss, and found the solution as such
I debug mode,I got nodeStr like this "<nodeID>5</nodeID><text>XXX</text><path>...</path>".
And so with the code "JSON.Deserialize<Newtonsoft.Json.Linq.JObject>(no deStr); " I got a exception like this "Unexpected character encountered while parsing value:<.Line 1,position 1."
How can I resolve it?
Thanks.
By the way,Why Ext.Net not support GetSelectedNode() fuction directed in the DLL?
<ext:Button runat="server" Text="Submit selected node">
<DirectEvents>
<Click OnEvent="SubmitNode">
<ExtraParams>
<ext:Parameter Name="node" Value="#{TreeGrid1}.convertToSubmitNode(#{TreeGrid1}.getSelectionModel().getSelectedNode())" Mode="Raw" Encode="true"/>
</ExtraParams>
</Click>
</DirectEvents>
</ext:Button>
protected void SubmitNode(object sender, DirectEventArgs e)
{
string nodeStr = e.ExtraParams["node"];
Newtonsoft.Json.Linq.JObject node = JSON.Deserialize<Newtonsoft.Json.Linq.JObject>(nodeStr);
string id = node.Property("nodeID").Value.ToString();
string path = node.Property("path").Value.ToString();
string task = node.SelectToken("attributes.task").ToString();
}
and I used such code in my web application.I debug mode,I got nodeStr like this "<nodeID>5</nodeID><text>XXX</text><path>...</path>".
And so with the code "JSON.Deserialize<Newtonsoft.Json.Linq.JObject>(no deStr); " I got a exception like this "Unexpected character encountered while parsing value:<.Line 1,position 1."
How can I resolve it?
Thanks.
By the way,Why Ext.Net not support GetSelectedNode() fuction directed in the DLL?