How to create a multi-dimensioned array in conventional ASP Javascript so that C# interop function c

  • Thread starter Thread starter Richard Lewis Haggard
  • Start date Start date
R

Richard Lewis Haggard

I am trying to create multi-dimensioned arrays in conventional ASP pages and
pass these arrays as arguments to functions that are in a C# interop
assembly. ASP complains because it doesn't recognize that the created array
is the same as the declared interface argument.

The C# function is expecting to receive a 2 dimensioned array and is
declared like this:
public object[] InteropFunc( string s1, object[] arValues );

What should the ASP side look like in order to call into the C# interop
function?
 
Richard,

And how are you expecting to pass that array to ASP.NET? The only way
you can do this is to set form values which will be passed on a post.

To that end, you can create a hidden field in your form which you set to
a string which you can then parse on the server side to recreate your array.

Hope this helps.
 
Thank you for your response. However, you've addressed a question that was
not asked. There's not the slightest bit of trouble returning an array from
the C# interop assembly to the ASP page. After all, from the ASP point of
view, the C# assembly is a COM server. That's the point of the interop
assembly. In any case, that was not my question. My question was going the
other way. How does one format up an array from an ASP page, using either
Javascript or VBScript or a combination of the two, such that the C# interop
can receive the array argument as type object[].

--
Richard Lewis Haggard
www.Haggard-And-Associates.com
Nicholas Paldino said:
Richard,

And how are you expecting to pass that array to ASP.NET? The only way
you can do this is to set form values which will be passed on a post.

To that end, you can create a hidden field in your form which you set
to a string which you can then parse on the server side to recreate your
array.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Richard Lewis Haggard said:
I am trying to create multi-dimensioned arrays in conventional ASP pages
and pass these arrays as arguments to functions that are in a C# interop
assembly. ASP complains because it doesn't recognize that the created
array is the same as the declared interface argument.

The C# function is expecting to receive a 2 dimensioned array and is
declared like this:
public object[] InteropFunc( string s1, object[] arValues );

What should the ASP side look like in order to call into the C# interop
function?
 
Thank you for your response. While that is on the schedule for sometime next
year, I need to solve this problem now or they will bring in another
consultant who can. If you have some useful ideas on how an ASP page can
format up an array, using either Javascript or VBScript or a combination of
the two, such that the C# interop can receive the array argument as type
object[] then I'd be the high grateful recipient of such wisdom.
--
Richard Lewis Haggard
www.Haggard-And-Associates.com
chanmm said:
Easiest way will be change your asp to asp.net I think.

chanmm

Richard Lewis Haggard said:
I am trying to create multi-dimensioned arrays in conventional ASP pages
and pass these arrays as arguments to functions that are in a C# interop
assembly. ASP complains because it doesn't recognize that the created
array is the same as the declared interface argument.

The C# function is expecting to receive a 2 dimensioned array and is
declared like this:
public object[] InteropFunc( string s1, object[] arValues );

What should the ASP side look like in order to call into the C# interop
function?
 
You weren't too specific about whether this call was being made on the
client side, or the server side. My assumption was on the client side,
hence my response.

If you are calling this from a server-side ASP.NET page, then you need
to change your interop declaration in such a way so that it matches the
number of dimensions that you are trying to pass ([,] for a two-dimensional
array, [,,] for three, etc, etc).

If this number is variable, then I believe you can declare it as Array,
but I don't know how well interop will handle that declaration.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Richard Lewis Haggard said:
Thank you for your response. However, you've addressed a question that was
not asked. There's not the slightest bit of trouble returning an array
from the C# interop assembly to the ASP page. After all, from the ASP
point of view, the C# assembly is a COM server. That's the point of the
interop assembly. In any case, that was not my question. My question was
going the other way. How does one format up an array from an ASP page,
using either Javascript or VBScript or a combination of the two, such that
the C# interop can receive the array argument as type object[].

--
Richard Lewis Haggard
www.Haggard-And-Associates.com
Nicholas Paldino said:
Richard,

And how are you expecting to pass that array to ASP.NET? The only way
you can do this is to set form values which will be passed on a post.

To that end, you can create a hidden field in your form which you set
to a string which you can then parse on the server side to recreate your
array.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Richard Lewis Haggard said:
I am trying to create multi-dimensioned arrays in conventional ASP pages
and pass these arrays as arguments to functions that are in a C# interop
assembly. ASP complains because it doesn't recognize that the created
array is the same as the declared interface argument.

The C# function is expecting to receive a 2 dimensioned array and is
declared like this:
public object[] InteropFunc( string s1, object[] arValues );

What should the ASP side look like in order to call into the C# interop
function?
 
Back
Top