开发者

How can I pass Collection to modal dialog window?

开发者 https://www.devze.com 2023-02-06 10:32 出处:网络
I want to know, if its possible to pass collection between pages. I mean to say i have a client-side JavaScript modal dialog on which I want to use my collection. Earlier I was using Session[] to shar

I want to know, if its possible to pass collection between pages. I mean to say i have a client-side JavaScript modal dialog on which I want to use my collection. Earlier I was using Session[] to share the value, but its becoming evil for me, as it always displays the first value. Any change in value in not updated.

So whenever my pop up is displayed I want the collection to get moved to the Child dialog. From there, i will extract the Collection, do some stuffs and again return it to parent page, preventing postbacks and session management.

I think i am clear to you开发者_如何转开发 guys. If not clear, please add comment.


You can try JSON or simply convert your List into a comma-delimited string which would be very easy to parse with JavaScript's string split function.

RegisterArrayDeclaration(arrayName, arrayValue) is another option. Check out the link.

From the link:

If you need to create a client-side JavaScript Array object with some set values, use this method to add a value to a specific array.

To add the values 1, 2, and 3 to a client-side Array object named FavoriteNumbers, you'd use the following server-side code:

RegisterArrayDeclaration("FavoriteNumbers", "1")
RegisterArrayDeclaration("FavoriteNumbers", "2")
RegisterArrayDeclaration("FavoriteNumbers", "3")

This code would emit the following client-side script:

<script language="javascript">
<!--
   var FavoriteNumbers =  new Array(1, 2, 3);
      // -->
</script>
0

精彩评论

暂无评论...
验证码 换一张
取 消