1. Check if you hit this URl with a browser what happens...

2. ASP.NET embeds securite measures into what can be POSTed to ASP.NET
page.
in web.config set <pages validateRequest="false">

3. Please see my POST 
http://groups.google.com/group/jquery-en/browse_thread/thread/a2f65e23c7f60e06?hl=en#
Your method might have problems. You need to read InputStream
completelly

George.

On Nov 18, 2:14 pm, mthakershi <[EMAIL PROTECTED]> wrote:
> Well.. I understand that. But it doesn't look that simple. I am not
> able to get the tree view example to work with ASP.NET. Here is the
> post I wrote in one other forum. Please see if you can help.
>
> Hello, I am not able to get this sample to work. It is driving me
> crazy. I think it is about setting up environment because it is not
> even calling the server-side page in debug mode. Please help.
>
> I have included necessary jQuery files in my project. I am right now
> trying on a sample page.
>
> Here is my HTML page:
>
> 1    <%@ Page Language="C#" AutoEventWireup="true"
> CodeBehind="SampleJson.aspx.cs" Inherits="TeleHealth.SampleJson" %>
> 2
> 3    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> 4    <html xmlns="http://www.w3.org/1999/xhtml";>
> 5    <head runat="server">
> 6        <title>Untitled Page</title>
> 7        <link href="Resources/Styles/jquery.treeview.css"
> rel="stylesheet" type="text/css" />
> 8
> 9        <script type="text/javascript" src="Resources/JS/
> jquery-1.2.6.js"></script>
> 10
> 11       <script type="text/javascript" src="Resources/JS/
> jquery.cookie.js"></script>
> 12
> 13       <script type="text/javascript" src="Resources/JS/
> jquery.treeview.async.js"></script>
> 14
> 15       <script type="text/javascript" src="Resources/JS/
> jquery.treeview.js"></script>
> 16
> 17       <script type="text/javascript">
> 18
> 19      function initTrees() {
> 20              $("#black").treeview({
> 21                      url: "GetTreeData.aspx"
> 22              })
> 23
> 24              $("#mixed").treeview({
> 25                      url: "GetTreeData.aspx",
> 26                      // add some additional, dynamic data and request with 
> POST
> 27                      ajax: {
> 28                              data: {
> 29                                      "additional": function() {
> 30                                              return "yeah: " + new Date;
> 31                                      }
> 32                              },
> 33                              type: "post",
> 34                   data: "{}",
> 35                   contentType: "application/json; charset=utf-8",
> 36                   dataType: "json"
> 37                      }
> 38              });
> 39      }
> 40
> 41      $(document).ready(function(){
> 42              initTrees();
> 43      });
> 44       </script>
> 45
> 46   </head>
> 47   <body>
> 48       <h4>
> 49           Lazy-loading tree</h4>
> 50       <ul id="black">
> 51       </ul>
> 52       <h4>
> 53           Mixed</h4>
> 54       <ul id="mixed">
> 55           <li><span>Item 1</span>
> 56               <ul>
> 57                   <li><span>Item 1.0</span>
> 58                       <ul>
> 59                           <li><span>Item 1.0.0</span></li>
> 60                       </ul>
> 61                   </li>
> 62                   <li><span>Item 1.1</span></li>
> 63               </ul>
> 64           </li>
> 65           <li id="36" class="hasChildren"><span>Item 2</span>
> 66               <ul>
> 67                   <li><span class="placeholder"> </span></li>
> 68               </ul>
> 69           </li>
> 70           <li><span>Item 3</span> </li>
> 71       </ul>
> 72   </body>
> 73   </html>
> 74
>
> Here is my server-side code:
>
> 1    namespace TeleHealth
> 2    {
> 3        public partial class GetTreeData : System.Web.UI.Page
> 4        {
> 5            protected void Page_Load(object sender, EventArgs e)
> 6            {
> 7                string pStrReply = "[     {               \"text\": \"1. 
> Review of
> existing structures\",             \"expanded\": true,           
> \"children\":         [                       {
> \"text\": \"1.1 jQuery core\"                       },                      { 
>                               \"text\": \"1.2 metaplugins
> \"                 }               ]       },      {               \"text\": 
> \"2. Wrapper plugins\"    },      {               \"text\": \"3.
> Summary\"  },      {               \"text\": \"4. Questions and answers\"     
>  }       ]";
> 8
> 9                //Response.ContentType = "application/json";
> 10               Response.CacheControl = "no-cache";
> 11               Response.Clear();
> 12               Response.Write(pStrReply);
> 13               Response.End();
> 14
> 15               pStrReply = null;
> 16           }
> 17       }
> 18   }
> 19
>
> Any help is appreciated.
>
> On Nov 18, 11:03 am, George <[EMAIL PROTECTED]> wrote:
>
>
>
> > I see,
> > the most common way to return JSON is to use [WebMethod]
>
> > example (in C#)
>
> >     [System.Web.Services.WebMethod(EnableSession = true)]
> >     public static object Fetch()
> >     {
> >        clsMyObject a = new clsMyObject;
> >        a.Name="George';
> >        return a;
> >     }
>
> > PS: you need EnableSession = true obly if you using Session variable
> > in your method.
> > George.
>
> > On Nov 18, 9:34 am, mthakershi <[EMAIL PROTECTED]> wrote:
>
> > > What I wanted to know is:
>
> > > In PHP example, on client side it says something like url: sources.php
> > > and then sources.php file returns JSON treeview nodes. What would be
> > > the server-side equivalent in ASP.NET for that? I am not able to find
> > > any example for that.
>
> > > Thank you for your help.
>
> > > On Nov 17, 7:21 pm, George <[EMAIL PROTECTED]> wrote:
>
> > > > I am not sure i understand....What is the exact problem?
>
> > > > JQuery is 100% client side... ASP.NET is 100% server side...
>
> > > > You should not have a problem to generate HTML with ASP.NET and use it
> > > > with JQuery tree  plugin
>
> > > > The only this i can guess you having a problem with is IDs since
> > > > ASP.NET generates it's own elemnet's IDs. But you can use class if you
> > > > want.. Or not mark items as runat="server" then ID's will be the ones
> > > > that you assigned.
>
> > > > George.
>
> > > > On Nov 17, 8:00 pm, mthakershi <[EMAIL PROTECTED]> wrote:
>
> > > > > Hi, I am trying to implement JQuery treeview with asp.net. I have
> > > > > master page and treeview is in child page. Can someone point me to an
> > > > > example that shows ASPX integration? I saw PHP one but I am not able
> > > > > to replicate the same thing in ASP.NET.
>
> > > > > Any help is appreciated.
>
> > > > > Thank you.- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

Reply via email to