469,628 Members | 1,231 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,628 developers. It's quick & easy.

How to create a multi-dimensioned array in conventional ASP Javascript so that C# interop function can read it?

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 Lewis Haggard
www.Haggard-And-Associates.com
Aug 3 '06 #1
5 1950
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]
- mv*@spam.guard.caspershouse.com

"Richard Lewis Haggard" <HaggardAtWorldDotStdDotComwrote in message
news:OA**************@TK2MSFTNGP02.phx.gbl...
>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 Lewis Haggard
www.Haggard-And-Associates.com

Aug 4 '06 #2
Easiest way will be change your asp to asp.net I think.

chanmm

"Richard Lewis Haggard" <HaggardAtWorldDotStdDotComwrote in message
news:OA**************@TK2MSFTNGP02.phx.gbl...
>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 Lewis Haggard
www.Haggard-And-Associates.com

Aug 4 '06 #3
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 [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote in
message news:u5**************@TK2MSFTNGP02.phx.gbl...
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]
- mv*@spam.guard.caspershouse.com

"Richard Lewis Haggard" <HaggardAtWorldDotStdDotComwrote in message
news:OA**************@TK2MSFTNGP02.phx.gbl...
>>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 Lewis Haggard
www.Haggard-And-Associates.com


Aug 4 '06 #4
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" <ch*****@hotmail.comwrote in message
news:ex**************@TK2MSFTNGP04.phx.gbl...
Easiest way will be change your asp to asp.net I think.

chanmm

"Richard Lewis Haggard" <HaggardAtWorldDotStdDotComwrote in message
news:OA**************@TK2MSFTNGP02.phx.gbl...
>>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 Lewis Haggard
www.Haggard-And-Associates.com


Aug 4 '06 #5
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]
- mv*@spam.guard.caspershouse.com

"Richard Lewis Haggard" <HaggardAtWorldDotStdDotComwrote in message
news:Og****************@TK2MSFTNGP05.phx.gbl...
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 [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote
in message news:u5**************@TK2MSFTNGP02.phx.gbl...
>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]
- mv*@spam.guard.caspershouse.com

"Richard Lewis Haggard" <HaggardAtWorldDotStdDotComwrote in message
news:OA**************@TK2MSFTNGP02.phx.gbl...
>>>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 Lewis Haggard
www.Haggard-And-Associates.com



Aug 5 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Grahammer | last post: by
2 posts views Thread by ME | last post: by
2 posts views Thread by cpressley2 | last post: by
4 posts views Thread by Laurence | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.