Hi,
I have a 3 dimenionsal array which I populate in my C# code.
I then want to make this available to my Javascript so I do below.
Page.ClientScri pt.RegisterArra yDeclaration("m yArray", myArray.ToStrin g())
When I view my source html I see var myArray = new Array(System.In t32[,])
What am I doing wrong here? 2 7169
the RegisterArrayDe claration is rather stupid and useless. it takes two
parameters, the array name and a string which is the actual javascript
array initialization code. for an int array it wants:
Page.ClientScri pt.RegisterArra yDeclaration("m yArray","1,2,3" );
so you need a helper routine for an int array (air code):
public string JScriptArrayDec laration(int[] a)
{
string s = "";
string sep = "";
for (int i=0; i < a.Length; ++i)
{
s += sep + a[i].ToString();
sep = ",";
}
return s;
}
-- bruce (sqlwork.com)
C wrote:
Hi,
I have a 3 dimenionsal array which I populate in my C# code.
I then want to make this available to my Javascript so I do below.
Page.ClientScri pt.RegisterArra yDeclaration("m yArray", myArray.ToStrin g())
When I view my source html I see var myArray = new Array(System.In t32[,])
What am I doing wrong here?
Thanks Bruce.
"bruce barker" wrote:
the RegisterArrayDe claration is rather stupid and useless. it takes two
parameters, the array name and a string which is the actual javascript
array initialization code. for an int array it wants:
Page.ClientScri pt.RegisterArra yDeclaration("m yArray","1,2,3" );
so you need a helper routine for an int array (air code):
public string JScriptArrayDec laration(int[] a)
{
string s = "";
string sep = "";
for (int i=0; i < a.Length; ++i)
{
s += sep + a[i].ToString();
sep = ",";
}
return s;
}
-- bruce (sqlwork.com)
C wrote:
Hi,
I have a 3 dimenionsal array which I populate in my C# code.
I then want to make this available to my Javascript so I do below.
Page.ClientScri pt.RegisterArra yDeclaration("m yArray", myArray.ToStrin g())
When I view my source html I see var myArray = new Array(System.In t32[,])
What am I doing wrong here?
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Kent Ogletree |
last post by:
I need to get some JavaScript values onto an aspx page and I am not finding
anything using Google. (probably not stumbled onto the right keywords)
The code behind has the object that conatins the info I need to get onto the
page. In old asp I would usually do:
var someStringValue = "<% = MyStringVar %>";
However everything I try right now has done nothing more than break the
page.
|
by: xenophon |
last post by:
I have a grid with checkboxes in it. When a checkbox is un/checked, I
want to set a true-false value in an array. Then on PostBack I can
work with that array.
I know I need to use RegisterArrayDeclaration, but I don't see a quick
tutorial how. Can anyone post sample C# code-behind-only code on how
to do this?
Thanks.
|
by: sck10 |
last post by:
Hello,
I have a page with an ImageButton that is used to redirect to another page.
When the page first opens, everything looks as expected. However, when I
click on the image, the new page opens as expected. However, when I go back
to the original page, all the font sizes are larger. Its as if by clicking
on the ImageButton, my CSS formatting was discarded.
When I look at the source for the following code, this is what I get:
|
by: Mori |
last post by:
I am using masterPage and I need to populate a textbox that is in a content
control with data from popup page that is not part of the master page. This
code works if no masterpage is involved. here is the javascript produced:
<script>window.opener.document.forms.txtEndDate.value =
'7/15/2006';self.close()</script>
I basically need to populate txtEndDate on the content page.
if
|
by: Jon Paal |
last post by:
"Page.Clientscript" does not compile in assembly, with the error message "Reference to a non-shared member requires an object
reference". ...
what reference is it looking for ??????
class class1
public sub showimg()
Dim Response As HttpResponse = HttpContext.Current.Response
Dim theImage As New object
| |
by: Chris Newald |
last post by:
Hello there,
I need to be able to call the System.Web.UI.Page object inside a custom
class without actually passing the Page object as an argument. Is there an
alternate way to access the page object from within a class? Something like
the HttpContext.Current object?
My class creates custom scripts that it then adds to the page using
Page.ClientScript.IsStartupScriptRegistered and
Page.ClientScript.RegisterStartupScript functions.
|
by: Chris Auer |
last post by:
I have one page that gets its contents from a class called
FormBuilder.cs. It generates a web part. On that page
GetWebResourceUrl works fine. All other pages generates an invalid
assembly key. If I change the type to the working class I can make it
work on any page.
Works
string scriptLocation =
Page.ClientScript.GetWebResourceUrl(typeof(FormsBuilderWebPart.FormBuilder),
"FormsBuilderWebPart.JScript1.js");
|
by: 0301102 |
last post by:
I using following script in my project. Once click the button and there will open a pop up window. But "Page.ClientScript.RegisterStartupScript" script seem NOT working in update panel. After remove Update panel and it is working properly. Any solution?
Page.ClientScript.RegisterStartupScript(Me.GetType(), "openpopup", "window.open('" & "child.aspx" & "','ChildWindow','height = 520, width = 730,status=no,location=no,directories=no, resizable =...
|
by: Bali |
last post by:
Default.aspx is the starting page containing a control(ascx) which has
asp:button control on it. On the button click event it has to open a
new page as a modal control. Since refreshing a page in a dialog box
ended up opening up a new browser window with the aspx page, I read on
a forum that I should use the iframe control and since I have to open
a bunch of pages as diaogboxes, I created a general
page(Container.aspx) which has an iframe...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |