Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    smartclient and .NET?

    Hi

    Just wondering if smartclient will work on ASP.NET?

    We have an existing web application written in C# .NET and interested in implementing smartclient.

    Will it work? what is the requirement.

    Thanks

    #2
    Yes, SmartClient can be integrated with .NET and C# applications, and several Isomorphic customers have succeeded with this model.

    General instructions on using SmartClient without using the SmartClient Java Server are here.

    Specific instructions on integrating DataSources with .NET are here. Two general approaches are possible:

    1. use Visual Studio to create web services from existing server-side methods, and then use SmartClient's WSDL Binding system to connect to those web services. Examples based on the popular .NET web services tutorials are provided (eg "temperature conversion service")

    2. use REST-based integration, creating ASP pages that generate XML or JSON responses to feed data to SmartClient components. SmartClient provides a "cookbook" integration plan here, providing samples of the exact XML or JSON data your ASP pages must produce.

    Comment


      #3
      thank you will try this.

      Comment


        #4
        Progress with .NET

        Hi,

        Just wondering if you had tried this, and if you had had any luck?

        Thanks,

        Comment


          #5
          Stewart:

          I'm currently developing in ASP.NET with SmartClient without problems (though I haven't gotten that far into using the SDK, so maybe I'll run into problems later). Did you have a particular question? If you like I can post some examples of .aspx pages that serve up JSON to be consumed by SmartClient Datasources.

          Comment


            #6
            I would be interested in seeing some example .aspx pages serving JSON data if you have a chance.

            Thanks!

            Comment


              #7
              Create an .aspx page with no markup, just the following two lines (change Language, CodeFile, and Inherits as necessary):

              Code:
              <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Data.aspx.vb" Inherits="Data" ValidateRequest="false" ContentType="text/javascript" %>
              <%@ OutputCache Duration="1" Location="None" VaryByParam="none" %>
              Then in the code-behind, add code to serve up a JSON object. Here's an example of a C# class that creates JSON for a fetch operation from a supplied DataTable:

              Code:
              public class JSONFetch
              {
                  public DataTable Table = new DataTable();
              
                  public string JSON(int statusCode)
                  {
                      string responseString = "";
              
                      responseString += "{response:{";
              
                      responseString += "status:" + statusCode;
              
                      responseString += ",data: [";
              
                      for (int row = 0; row < Table.Rows.Count; row++)
                      {
                          responseString += jsonRow(row);
              
                          if (row != Table.Rows.Count - 1)
                              responseString += ",";
                      }
              
                      responseString += "]";
                      responseString += "}}";
              
                      return responseString;
                  }
              
                  private string jsonRow(int rowIndex)
                  {
                      string rowString = "";
                      
                      JavaScriptSerializer serializer = new JavaScriptSerializer();
              
                      rowString += "{";
              
                      for (int col = 0; col < Table.Columns.Count; col++)
                      {
                          rowString += "\"" + Table.Columns[col].ColumnName + "\":" + serializer.Serialize(Table.Rows[rowIndex][col]);
              
                          if (col != Table.Columns.Count - 1)
                              rowString += ",";
                      }
              
                      rowString += "}";
              
                      return rowString;
                  }
              }
              Then use that class in your codebehind to create and serve the JSON string:

              Code:
              Dim myResponse As New JSONFetch()
              
              Select Case Request.QueryString("operationType")
                  Case "fetch"
                      Dim dataAdapter As New SqlDataAdapter("[your query]", _
                                  "[your connection string]")
              
                      Dim dataItems As New Data.DataTable
              
                      dataAdapter.Fill(dataItems)
              
                      myResponse.Table = dataItems
              
                      Response.Write(myResponse.JSON(0))
                  Case Else
                      Response.Write(myResponse.JSON(-1))
              End Select

              Comment


                #8
                Hi,
                i am using .net as well so far i am able to insert new rows and fetch data with a ListGrid and still have to fix delete and update operation.
                but was thinking since i saw many posts about smartclient usage with .net why no share information over an irc channel (something like: #smartclient on freenode) that way we can help each other and it would be faster for all of us to fix problems
                regards

                Comment


                  #9
                  Eljak,

                  I would much prefer to communicate with .NET developers in a forum medium. I find instant messaging inconvenient (most IM clients are nasty, mean, ugly, invasive, hurtful monsters of some tortured soul's dark and infernal nightmare) and disruptive (since when somebody IMs me I have to stop thinking about what I'm working on and lose my whole train of thought).

                  For SmartClient-related communication I think this forum would work well. Otherwise, I might be interested in starting up a website with a forum for discussing .NET as it relates to various client-side libraries, if there's enough interest.

                  Comment


                    #10
                    Here's an interesting idea though.

                    All SmartClient components can be created by simply injecting the necessary Javascript definition into your HTML page, wrapped in <SCRIPT></SCRIPT> tags. In .NET we can create server-side controls that render content to the browser based on their properties (and this content can easily include Javascript).

                    Therefore, it should be possible to create .ascx wrappers for common SmartClient controls so that a .NET developer can do all SmartClient development with server-side tags, without having to write any Javascript at all (or at most only a little Javascript). It should also be possible to make rich-client versions of most popular .NET controls.

                    I don't really have the time to do much work on that sort of project right now, but I might be interested in doing something like that soon. Anyone else think this is a useful idea?

                    Comment


                      #11
                      Hi ledfini,

                      That would be a great thing to contribute to the community if you have the time. There are certainly many developers who would benefit from something like that.

                      Comment


                        #12
                        Sorry, misspelled your name - infidel backwards, right?

                        Comment


                          #13
                          smartclient and php

                          How can i create json in php/mysql?

                          Comment


                            #14
                            Hi liny,

                            Most people recommend using PHP's json_encode() function. Search the forums for this to find examples.

                            Comment


                              #15
                              Hi Ledifni,

                              I am curious how you are handling authentication and authorization. In .Net the standard way to do this is using forms auth cookies and securing individual pages, put if you page is html and using webserivces/rest pages how do you control access to them?

                              Thanks,

                              Frank

                              Comment

                              Working...
                              X