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

  • smartclient and .NET?


    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.


  • #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.


    • #3
      thank you will try this.


      • #4
        Progress with .NET


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



        • #5

          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.


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



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

              <%@ 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:

              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:

              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
                      myResponse.Table = dataItems
                  Case Else
              End Select


              • #8
                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


                • #9

                  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.


                  • #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?


                    • #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.


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


                        • #13
                          smartclient and php

                          How can i create json in php/mysql?


                          • #14
                            Hi liny,

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


                            • #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?