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 |
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>
|