Not sure what I am doing wrong so hopefully one of you can shed some light on this!
I am creating an ArrayList in C# then passing it to a javascript in a webbrowser.
When trying to read values, I keep getting an "undefined" value for the Array item , i.e. sData[3] in the javascript.
If I do an alert(sData.Count) it does display the correct count for the Array.
Everything up to reading the Array works, the select box gets cleared, etc. But then nothing is passed.
Any help would be appreciated.
C# code:
public class MainForm : Form
{
ArrayList SelectDisplay = new ArrayList();
ArrayList SelectData = new ArrayList();
void PassData_BtnClick(object sender, EventArgs e)
{
FillSelectArrays("Start","none");
FillSelectArrays("One Test","one");
FillSelectArrays("Two Test","two");
FillSelectArrays("Three Test","three");
browser.Document.InvokeScript("FillSelectFromArrays", new object[] { ch.Name, SelectDisplay, SelectData });
}
private void FillSelectArrays(string display, string data)
{
//The Arrays are already defined
SelectDisplay.Add(display);
SelectData.Add(data);
}
private void ClearSelectArrays()
{
SelectDisplay.Clear();
SelectData.Clear();
}
html & javascript:
Thanks!
Sean Murphy
"All things great and small start at the same point, the first step."
Sean Murphy
"All things great and small start at the same point, the first step."
SamPosted Jul 26, 2007, 3:05 PM
Maybe you might have to iratate through the c# arrays and pass
each item individually to javascript functions.
Sam