CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 Ajax (httprequest) Support?

Print topic Send  topic

Author Message
Warren
Posted: 08/31/2005, 5:02 AM

Hi Guys

Im just evaluating this product at the moment and am getting more impressed by the minute!

Is there or will there be support for ajax type modules ie submitting the data without refreshing the page.

Cheers!

Warren
dekacode

Posts: 53
Posted: 09/06/2005, 2:42 PM

I would be interested in hearing about plans for Ajax support in CCS Studio
View profile  Send private message
peterr


Posts: 5971
Posted: 09/06/2005, 2:58 PM

Most of the plans for future versions of CodeCharge Studio are either unspecified or confidential. For example no one knew about the reporting feature in CCS until it was ready. You will also not know about any major new features until they are announced. And most likely they will not be announced to the public at all, therefore I couldn't answer such questions even if knew the answer. Possibly under an NDA.
Generally currently we're working on finalizing the version 3.0 of CCS, therefore I'd say that this is the main plan for now.

You can also see that nobody requested Ajax support yet: http://forums.codecharge.com/search.php?s_keyword=ajax&...[]=22&s_period=
If no one is interested in a specific feature or technology then the chance of it being planned may be smaller.

Finally, it would be nice if our users added the support for Ajax, created new wizards, components and examples. CCS is not fully opened but some extensions, components, actions, wizards and examples were created by others, plus we can help anyone who is serious about this.
Thus we also would be interested in hearing about anyone's plans for Ajax support in CCS Studio... :-)
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
Ozum

Posts: 57
Posted: 10/07/2005, 12:43 AM

I think Ajax would be great addition to CCS. It helps us, the developers, to build more modern web applications.

Regards
View profile  Send private message
peterr


Posts: 5971
Posted: 10/07/2005, 12:57 AM

Please feel free to submit Ajax wishes to the Wishes forum, but please specify exactly which Ajax-specific feature(s) you're interested in.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
Isaac
Posted: 10/13/2005, 11:34 AM

so i came up with a way to implemet ajax in codecharge.
i am using vb.net but it can be converted to any lang.

1. create an includeable page on the root called ajax.
2. place this code in the html section:
<meta name="GENERATOR" content="CodeCharge Studio 3.0.0.49">  
<meta http-equiv="content-type" content="text/html; charset=windows-1252">  
<script language="Javascript">  
var debug = false;  
function GetXmlHttp() {  
	var xmlhttp = false;  
	if (window.XMLHttpRequest){  
		xmlhttp = new XMLHttpRequest();  
	}  
	else if (window.ActiveXObject)// code for IE  
	{  
		try  
		{  
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP")  
		} catch (e) {  
			try  
			{  
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP")  
			} catch (E) {  
				xmlhttp=false;  
			}  
		}  
	}  
	return xmlhttp;  
}  
  
function PassAjaxResponseToFunction(url, callbackFunction, params)  
{  
  
  var xmlhttp = new GetXmlHttp();  
  //now we got the XmlHttpRequest object, send the request.  
    
if (xmlhttp)  
  {  
    xmlhttp.onreadystatechange = function ()  
            {  
              if (xmlhttp && xmlhttp.readyState==4)  
              {//we got something back..  
                if (xmlhttp.status==200)  
                {  
                  var response = xmlhttp.responseText;  
                  var functionToCall = callbackFunction +   
                                 '(response,'+params+')';  
  
                  if(debug)  
                  {  
                    alert(response);  
                    alert(functionToCall);  
                  }  
                  eval(functionToCall);  
  
                } else if(debug){  
                  document.write(xmlhttp.responseText);  
                }  
              }  
            }  
  
    xmlhttp.open("GET",url,true);  
    xmlhttp.send(null);  
  }  
}  
  
function SetInnerHTMLFromAjaxResponse(url, obj_id)  
{  
  var xmlhttp = new GetXmlHttp();  
  //now we got the XmlHttpRequest object, send the request.  
    
if (xmlhttp)  
  {  
    xmlhttp.onreadystatechange = function ()  
            {  
              if (xmlhttp && xmlhttp.readyState==4)  
              {//we got something back..  
                if (xmlhttp.status==200)  
                {  
					if(debug){  
						alert(xmlhttp.responseText);  
					}  
  
					if(typeof obj_id == 'object')  
					{  
						obj_id.innerHTML = xmlhttp.responseText;  
					} else {  
						document.getElementById(obj_id).innerHTML = xmlhttp.responseText;  
					}  
                } else if(debug){  
                  document.Write(xmlhttp.responseText);  
                }  
              }  
            }  
    xmlhttp.open("GET",url,true);  
    xmlhttp.send(null);  
  }  
}  
</script>  

3. create a before show event and add a function call
HandleAjaxEvent()

4. create the following functions
  
	function HandleAjaxEvent()  
		Dim _method as string = Request.QueryString("_method")  
		select case _method  
			case "GetHtml"  
                'demonstrates the use of the GetHtml() function.  
                'if you wanted to use controls that   
                'are created using the designer on the aspx page,  
                'you can set their visibility to false initially.  
                'then temporarily set visibility to true,  
                'call GetHtml()  
                'This would be the best thing to do with   
                'a repeater, trying to create one in code is a lot of work.  
                '(or just use for loops to create html.)  
                dim l as  System.Web.UI.WebControls.Label =  new  System.Web.UI.WebControls.Label()  
                l.Text = "Ajax is hot!"  
                l.BackColor = Color.Honeydew  
                l.BorderWidth = Unit.Parse(6)  
                l.BorderStyle = BorderStyle.Groove  
                l.BorderColor = Color.Goldenrod  
                Response.Write(GetHtml(l))  
                Response.End()  
			case "GetCustomerDetailsByName"  
			    Dim name as string = Request.QueryString("name")  
                Response.Write(GetCustomerDetailsByName(name))  
                Response.End()  
			case "GetCustomersDataTable"  
            	Dim dg as DataGrid = new DataGrid()  
                dg.AutoGenerateColumns = true  
                Dim min_orders as string =Request.QueryString("min_orders")  
                Dim dt as DataTable = GetCustomersDataTable()  
                Dim dv as DataView = new DataView(dt)  
                dv.RowFilter="Orders > " & min_orders  
                dg.DataSource = dv  
                dg.DataBind()  
                Response.Write(GetHtml(dg))  
                Response.End()  
		end select  
	end function  
  
	function GetCustomersDataTable() as DataTable  
	    'Go to the Database and return a table.   
	  	' Create a new DataTable.  
	    Dim myDataTable As DataTable = new DataTable("Customers")  
	    ' Declare variables for DataColumn and DataRow objects.  
	    Dim myDataColumn As DataColumn   
	    Dim myDataRow As DataRow   
  
	    ' Create new DataColumn, set DataType, ColumnName and add to DataTable.      
	    myDataColumn = New DataColumn()  
	    myDataColumn.DataType = System.Type.GetType("System.Int32")  
	    myDataColumn.ColumnName = "id"  
	    myDataColumn.ReadOnly = True  
	    myDataColumn.Unique = True  
	    ' Add the Column to the DataColumnCollection.  
	    myDataTable.Columns.Add(myDataColumn)  
  
	    ' Create second column.  
	    myDataColumn = New DataColumn()  
	    myDataColumn.DataType = System.Type.GetType("System.Int32")  
	    myDataColumn.ColumnName = "Orders"  
	    myDataColumn.AutoIncrement = False  
	    myDataColumn.Caption = "Orders"  
	    myDataColumn.ReadOnly = False  
	    myDataColumn.Unique = False  
	    ' Add the column to the table.  
	    myDataTable.Columns.Add(myDataColumn)  
  
	    ' Make the ID column the primary key column.  
	    Dim PrimaryKeyColumns(0) As DataColumn  
	    PrimaryKeyColumns(0)= myDataTable.Columns("id")  
	    myDataTable.PrimaryKey = PrimaryKeyColumns  
  
	    ' Instantiate the DataSet variable.  
	    Dim myDataSet as System.Data.DataSet = New System.Data.DataSet()  
	    ' Add the new DataTable to the DataSet.  
	    myDataSet.Tables.Add(myDataTable)  
  
	    ' Create three new DataRow objects and add them to the DataTable  
	    Dim i As Integer  
	    For i = 0 to 2  
	       myDataRow = myDataTable.NewRow()  
	       myDataRow("id") = i  
	       myDataRow("Orders") = i * 10  
	       myDataTable.Rows.Add(myDataRow)  
	    Next i  
		return myDataTable  
	end function   
  
	function GetCustomerDetailsByName(name)  
		return "Nigel,Liefrink,27"  
	end function  
  
	'<summary>  
	'Helper to get a html string  
	'representation of the passed Control.  
	'</summary>  
	'<param name="c">Control to return Html for</param>  
	'<returns>Html of control</returns>  
	private function GetHtml(c as Control) as string  
	    Dim sb as System.Text.StringBuilder = new System.Text.StringBuilder()  
	    Dim tw as System.Web.UI.HtmlTextWriter = new System.Web.UI.HtmlTextWriter(new System.IO.StringWriter(sb))  
	    try  
	        c.RenderControl(tw)  
	    finally  
	        tw.Close()  
	    end try  
	    return sb.ToString()  
	end function  

5. test by creating a page that will have ajax file included at the top
and will have these test buttons
  
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">  
<html>  
<head>  
<meta name="GENERATOR" content="CodeCharge Studio 3.0.0.49">  
<meta http-equiv="content-type" content="text/html; charset=windows-1252">  
<title>testAjax</title>  
<link href="../Styles/Tile/Style.css" type="text/css" rel="stylesheet">  
</head>  
<body>  
 {ajax}  
<input type="button"   
  onclick="SetInnerHTMLFromAjaxResponse('?_method=GetHtml','div_to_put_html')"  
  value="Get Some Html From The Server" ID="Button1" NAME="Button1" />  
<div id="div_to_put_html"></div>  
<br><br>  
<div id="div_0"></div>  
<div id="div_1"></div>  
<div id="div_2"></div>  
  
<input type="button"   
  onclick="PassAjaxResponseToFunction('?_method=GetCustomerDetailsByName',   
          'eGetCustomerDetailsByName',   
          '\'div_0\',\'div_1\',\'div_2\'');"  
  value="Pass eGetCustomerDetailsByName To A Function" ID="Button2" NAME="Button2" />  
  
  
<script language=javascript>  
function eGetCustomerDetailsByName(response, d0, d1, d2){  
    //we are expecting r to look like 'value1,value2,value3'  
    var data = response.split(',');  
    document.getElementById(d0).innerHTML = data[0];  
    document.getElementById(d1).innerHTML = data[1];  
    document.getElementById(d2).innerHTML = data[2];  
}  
</script>  
  
<br><br>  
<input type="button"   
  onclick="PassAjaxResponseToFunction('?_method=GetCustomersDataTable&min_orders=2',   
                          'eGetCustomersDataTable');"  
  value="Pass eGetCustomersDataTable To A Function" ID="Button3" NAME="Button3" />  
<script language=javascript>  
function eGetCustomersDataTable(r){  
	alert('here')  
    //we are expecting r to look like 'value1,value2,value3'  
    var data = r.split(',');  
    for(var i=0;i<data.length;i++){  
        document.getElementById('div_'+i).innerHTML = data;  
    }  
}  
</script>  
</body>  
</html>  
marcwolf


Posts: 361
Posted: 10/13/2005, 4:36 PM

Thanks for the info..

I have just asked for AJAX support before reading this entry.

I think that Client Side callbacks are a great technology as we have been using our own varient for over a years now.

We have mainly been using IFrames to handle the communications back and forth but AJAX is much more evolved. Recently we have been looking at the HTTPRequest function to see how we can implement it.

Just wish CCS was a little easier to build wizards into :>

Take Care

Dave

_________________
' Coding Coding Coding
Keep Those Keyboards Coding.
Raw Code!!!!!!!
View profile  Send private message
Isaac
Posted: 10/15/2005, 1:40 AM

;-) I hear you.
the only issue i found with ajax is that it does not work for mac IE
but you know what?
who cares about them... ;-)
marcwolf


Posts: 361
Posted: 10/19/2005, 11:16 PM

Now. Now.. Issac.

There is always FireFox, atleast that what we tell our Mac clients.

It is a problem when technologies move ahead of applications.. But I think its possible to implement fallback methods using iframes etc.

I saw an article on Goolge Suggest application that used both AJAX and IFrames.

here is the link to it..

http://serversideguy.blogspot.com/2004/12/google-suggest-dissected.html

Take Care

Dave

_________________
' Coding Coding Coding
Keep Those Keyboards Coding.
Raw Code!!!!!!!
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.