Visual Basic .NET » ASP.NET General Discussion
passing clent date to server -- jkenne19 --


I need help passing an array from a JavaScript functions to the sever.
I am using the 1.4 frame work.

Here is the example that I'm trying to use.

function UpdateData()
{

ArrayData.Rows
.name = "name";
ArrayData.Rows
.name2 = "Names2";
ArrayData.Rows
.address = "Address";
ArrayData.Rows
.city = "City";
ArrayData.Rows
.zipcode = "Zipcode";
ArrayData.Rows
.telephone = "Telephone";
ArrayData.Rows
.Fax = "Fax";
ArrayData.Rows
.email = "Email";
AddEditData.GetDateData (ArrayData,GetMessageOfTheDay_CallBack);
}

Server said code

public string GetDateData(string
StrData)
{
return BuildUpdateData(StrData);
}

-- Michael Schwarz --


Hi,

I cannot see any "date", and you have to use a string array for your method. Maybe you asked for something different, can you be a little bit clearer? Thanks!

Regards,
Michael

On 7/9/06, jkenne19 wrote:

I need help passing an array from a JavaScript functions to the sever.
I am using the 1.4 frame work.

Here is the example that I'm trying to use.

function UpdateData()
{

ArrayData.Rows
.name = "name";
ArrayData.Rows
.name2 = "Names2";
ArrayData.Rows
.address = "Address";
ArrayData.Rows
.city = "City";
ArrayData.Rows
.zipcode = "Zipcode";
ArrayData.Rows
.telephone = "Telephone";
ArrayData.Rows
.Fax = "Fax";
ArrayData.Rows
.email = "Email";
AddEditData.GetDateData (ArrayData,GetMessageOfTheDay_CallBack);
}

Server said code

public string GetDateData(string
StrData)
{
return BuildUpdateData(StrData);
}
>

--  

Best regards | Schöne Grüße Michael

Microsoft MVP - Most Valuable Professional Microsoft MCAD - Certified Application Developer

http://weblogs.asp.net/mschwarz 
/
http://www.schwarz-interactive.de 
/
mailto:info
-- jkenne19 --


Ok I've figured out the solution to my problem by using version 6.6.7.1. the code is below.

JavaScript code function BuildDataSet()
{
var ds = new Ajax.Web.DataSet();
var dt = new Ajax.Web.DataTable();

var txtValue3 = document.getElementById("TextBox3");
var txtValue4 = document.getElementById("TextBox4");
var txtValue5 = document.getElementById("TextBox5");
var txtValue6 = document.getElementById("TextBox6");
var txtValue7 = document.getElementById("TextBox7");
var txtValue8 = document.getElementById("TextBox8");

var StrTest1 = txtValue3.value;
var StrTest2 = txtValue4.value;
var StrTest3 = txtValue5.value;
var StrTest4 = txtValue6.value;
var StrTest5 = txtValue7.value;
var StrTest6 = txtValue8.value;

//Build column names
dt.addColumn("Test1", "System.String");
dt.addColumn("Test2", "System.String");
dt.addColumn("Test3", "System.String");
dt.addColumn("Test4", "System.String");
dt.addColumn("Test5", "System.String");
dt.addColumn("Test6", "System.String");

// Build table row

dt.addRow({"Test1":StrTest1,"Test2":StrTest2,"Test3":StrTest3,

"Test4":StrTest4,"Test5":StrTest5,"Test6":StrTest6});

ds.addTable(dt);

TestFolder3_Default2.BuildInfo(ds,GetDataInfo_CallBack);
}

C# code


public string BuildInfo(AjaxPro.JavaScriptObject DataSetInfo)
{
return GetDataGridInfo2(DataSetInfo);
}
public string GetDataGridInfo2(AjaxPro.JavaScriptObject DataSetInfo)
{
string StrTest1 = null;
string StrTest2 = null;
string StrTest3 = null;
string StrTest4 = null;
string StrTest5 = null;
string StrTest6 = null;

string StrBuildDataGrid = "The value from the JavaScript Table is";
AjaxPro.DataSetConverter oConverter = new axPro.DataSetConverter();
try
{
// object sent from client is deserializaed here
object oWrapper = oConverter.Deserialize(DataSetInfo,
Type.GetType("System.Data.DataSet"));
//object is correctly casted to the DataSet type
DataSet oDS = (DataSet)oWrapper;
foreach (DataRow NewDataRow in oDS.Tables
.Rows)
{
StrTest1 = NewDataRow
.ToString();
StrTest2 = NewDataRow
.ToString();
StrTest3 = NewDataRow
.ToString();
StrTest4 = NewDataRow
.ToString();
StrTest5 = NewDataRow
.ToString();
StrTest6 = NewDataRow
.ToString();
}
StrBuildDataGrid = StrBuildDataGrid + StrTest1 + " " +
StrTest2 + " " + StrTest3 + " " +
StrTest4 + " " +StrTest5 + " " +
StrTest6 + " ";
}
catch (Exception ex)
{
Response.Write("The error is " + ex.ToString());
Response.Write("<BR>");
}

return StrBuildDataGrid;
}

[Submit Comment]Home