|
|
Comments and Discussions
|
|
 |

|
Hi:
I am trying to figure out which license applies to CXEdit. Can you please help me with this?
Thanks,
Gwyn
|
|
|
|

|
<script type="text/jscript" language="javascript" src="rs.js"></script>
<script type="text/jscript" language="javascript">
var interval = "";
function OnPageLoad() {
interval = window.setInterval("Update()", 50000);
}
function Update() {
RS.Execute("Chat.aspx", "redraw");
RS.PopupDebugInfo();
}
</script>
public void redraw()
{
int[] exp = new int[l.Count];
List<Message> updList = new List<Message>();
ChatBox.Text += "r";
for (int i = 0; i < l.Count; i++)
{
Message m = l[i];
if (!m.isExpired())
{
updList.Add(m);
}
ChatBox.Text = m.getMsg() + "\n" + ChatBox.Text;
}
l = updList;
onlineBox.Text = "Online";
foreach(String s in users)
{
onlineBox.Text += "\n" + s;
}
}
Won't work. The method returns "Busy" on debug popup. Any help?
|
|
|
|

|
Hi, on all of my systems (vista, xz, 2k3 either in english or in italian) this character [’] (without the brackets) causes an error.
I'm using the code changes suggested here
http://www.codeproject.com/KB/aspnet/AlvaroRemoteScripting.aspx?msg=1343968[^] but no luck.
The error is:
System.FormatException occurred
Message="Could not find any recognizable digits."
Source="mscorlib"
StackTrace:
at System.ParseNumbers.StringToInt(String s, Int32 radix, Int32 flags, Int32* currPos)
at System.Convert.ToInt16(String value, Int32 fromBase)
at AMS.Web.RemoteScriptingClient.JS.DecodeUrl(String url) in D:\Progetti\PMC\INVCIW\v.1.0.0\branches\1.10.0.0b\src\RemoteScripting.cs:line 416
Any help would be greatly appreciated.
Regards,
Massimiliano
|
|
|
|

|
Hi, All,
I have seperated the reDemo.aspx to two files.
in reDemo.aspx:
RS.Execute("reDemoServer.aspx","UpdateAmounts", .............."
Inside reDemoServer.aspx file, declare the function UpdateAmounts(), I change the server side code from C# to VB.Net, everything works fine.
But if I include a file that create DB connection, when I return the connection string, it's empty.
Can anybody tell me what's wrong.
The codes in reDemoServer.aspx are as the following:
<![CDATA[<%@ Page Language="VB" %>]]>
<!-- #INCLUDE FILE="../../include/dbConnection.aspx" -->
<script language="VB" runat="server">
Private Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
If AMS.Web.RemoteScripting.InvokeMethod(Page) Then
Return
End If
End Sub
Public Function UpdateAmounts(ByVal argu1 as string) As String
Return "Return String From Remote Scripting." 'Works fine
'Return myConn 'myConn is defined in above include file, it's a
'string , but when I return it, it's an empty.
End Function
</script>
I need to solve this soon, otherwise I cannot do the furthere work.
Please help, thanks!
Andraw
|
|
|
|

|
I use VB instead of C#. Nothing wrong, but callBack() function is not trigered. In client-side in file1.aspx: <script language='JavaScript' src='/script/rs.js'></script> <script language='JavaScript' > function xxxx(){ RS.Execute("anotherFile.aspx", "CreateHolder1", callBack); } function callBack(result){ alert(result); } <script> ''''''''''''''''''''' In server-side in anotherFile.aspx: <@ Page Language="VB" > <%if AMS.Web.RemoteScripting.InvokeMethod(Page) then response.end end if Function CreateHolder1() As String CreateHolder1= "OK" exit Function %> Can anybody tell me what's wrong? Thanks! Andraw
|
|
|
|

|
Sorry mistyping, exit Function should be end function. but still doesn't work.
|
|
|
|

|
Hi,
I have question, I seperate the rsDemo.aspx to two files, put the remote call function to another file(called rsDemoServe.aspx), inside this file:rsDemoServe.aspx are:
<!-- Remote Scripting Demo -->
<script language="C#" runat="server">
void Page_Load(object sender, EventArgs e)
{
if (AMS.Web.RemoteScripting.InvokeMethod(Page))
return;
}
public string UpdateAmounts(string type)
{
return "OK|Hello|Lucy"; //result.ToString();
}
</script>
But when I modify the code as VB formate, it don't work. Do I must use C#?
Andraw
|
|
|
|

|
Hi Alvaro,
I'm using your code in an ASP.net 2.0 application and it is really useful.
Recently I have following problem:
When I'm calling a server-side method from my javascript and pass a string as parameter which contains an "umlaut" like the word "eisbär", during the transfer it transforms to "eisbr". In the server-side method which is called only the wrong parameter arrives.
Is there a possibility to change the charset or text encoding (I'm not sure) so that I can use UTF-8 characters?
I would be thankful for any information or ideas.
Veronika
|
|
|
|
|

|
I have problem getting this to work with .Net 2.0. Does anyone has this work w/ 2.0?
Error msg:
---------------------------
Microsoft Internet Explorer
---------------------------
System.MissingMethodException: Method 'ASP.default_aspx.Method1' not found.
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args)
at AMS.Web.RemoteScriptingClient.InvokeMethod() in RemoteScripting.cs:line 265
---------------------------
OK
---------------------------
To repro, here is the code:
Code:
My aspx page:
--------------------------------------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<script type="text/javascript" src="Scripts/rs.js"></script>
</head>
<body>
<script language="javascript" type="text/javascript">
function Method1CallBack(results)
{
alert('Method1CallBack returned results: ' + results);
}
function ExecMethod1()
{
alert('in ExecMethod1');
RS.Execute('Default.aspx', 'Method1',
'value1', 'Method1CallBack');
}
</script>
<form id="form1" runat="server">
<asp:Button ID="SubmitButton" runat="server" OnClientClick="ExecMethod1(); return false;" Text="Submit" />
</form>
</body>
</html>
--------------------------------------------------
My aspx.cs code:
--------------------------------------------------
using System;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (AMS.Web.RemoteScripting.InvokeMethod(Page))
return;
}
public string Method1(string value)
{
return "true,";
}
}
--------------------------------------------------
-TL
-- modified at 18:32 Wednesday 13th June, 2007
|
|
|
|

|
Hi Timothy,
On first sight I would say don't use quotes in this place:
instead of
RS.Execute('Default.aspx', 'Method1', 'value1', 'Method1CallBack');
use
RS.Execute('Default.aspx', 'Method1', value1, Method1CallBack);
Only an idea, thats the way I use it.
Veronika
|
|
|
|

|
Thanks Veronika, that was it. I put the call back function in quote. The correct call should be:
RS.Execute('Default.aspx', 'Method1', 'value1', Method1CallBack);
This still works beautifully in VS 2005.
-TL
|
|
|
|

|
Hi, i download your example app in C# , and i add new lines :
i am created a checkbox type ASP ------> <asp:CheckBox ID="CheckBox1" runat="server" Checked="false" /> , your status cehcked is false
And in the method public string UpdateAmounts(string type) , i add a new line -
----->CheckBox1.Checked = true;
but when executed this program, the checkbox don't changed??? please tell me , what do wrong?
thansk for you answer
|
|
|
|

|
Hi Alvaro.
You look like the one who gave the direction to Microsoft on how to make Callback in their 2005 .NET version.
I am a beginner programmer, and I want to know if I can use your code for one of my projects at work.
Thanks,
Sookhee
|
|
|
|

|
MyDays wrote: I am a beginner programmer, and I want to know if I can use your code for one of my projects at work.
Of course, help yourself.
Regards,
Alvaro
Eat right. Exercise. Die anyway.
|
|
|
|

|
I recently (today) came across this article and thought that is exactly what I need to do as part of my Msc project.
So I downloaded you code, it worked fine.
I then created my own page, like yours, but I dont want a callback to the client, I simply want to call a server side method, and thats it. Which seems to be ok, with what you have implemented, as you state that the callback is optional.
OK, so what I need to do is, call the method from the client, then in the method at server side, I want to change some properties of another (more in the real project) of another server side web control, you know with the runat="server" attribute. The samll page I am trying it on has a TextBox, and I am trying to change the Text property in the remote method call, Like shown below
THE MARKUP: Tets.aspx
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<%@ Page language="c#" Codebehind="Tets.aspx.cs" AutoEventWireup="false"
Inherits="ASP_pics.Tets" %><br>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" ><br>
<HTML><br>
<HEAD><br>
<title>Tets</title><br>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET
7.1"><br>
<meta name="CODE_LANGUAGE" Content="C#"><br>
<meta name="vs_defaultClientScript" content="JavaScript"><br>
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"><br>
<script language="'javascript'" src='scripts/rs.js'></script><br>
<script language="'javascript'"><br>
function testServerScript()<br>
{ <br>
window.status = "A Small maybe niave test...";<br>
RS.Execute("Tets.aspx", "PopulateText", "some text for
TextBox1");<br>
alert("testServerScript was called");<br>
}<br>
</script>
<p> </HEAD><br>
<body MS_POSITIONING="GridLayout" onload="testServerScript();"><br>
<form id="Form1" method="post" runat="server"><br>
<asp:Button id="Button1" Runat="server" Text="Button"></asp:Button><br>
<asp:TextBox id="TextBox1" runat="server" Width="216px"></asp:TextBox><br>
</form><br>
</body><br>
</HTML><br>
</p>
</body>
</html>
THE CODE BEHIND: Tets.aspx.cs
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace ASP_pics
{
So thats what I am tring to do, but am totally not getting, if what you have done, even allows for this. It should, shouldnt it, or have I got it completely wrong.
I am new to the whole Ajax style of thing, I get the concept, I know this is not Ajax, but to me it is exactly what I wanted, An Ajax type of arrangement, where I could call a server method, without a callback, this is what I want to do.
PLEASE PLEASE PLEASE could you have a look at this simply example I am doing, and see what I am doing wrong.
I would be happy to email source if you like, my email, is sachabarber@hotmail.com
MANY THANKS
sacha barber
|
|
|
|

|
If you haven't already, I recommend you use an Ajax implementation, like Anthem.NET which will do what you want. However, to answer your particular question, you really didn't need Remote Scripting to change a textbox on the form. You could have done it with some simple Javascript on the client:
document.getElementById("TextBox1").value = "some text for TextBox1";
Regards,
Alvaro
Eat right. Exercise. Die anyway.
|
|
|
|

|
Yeah its has been working with Ajax library for .NET for ages, its all cool
Sacha Barber
A Modern Geek - I cook, I clean, I drink, I Program. Modern or what?
My Blog : sachabarber.net
|
|
|
|

|
Hi Alvaro,
Thank you very much for this implementation. I am using it and it's working great.
I am new to ASP.NET so I hope my question won't be too silly.
I have a "xxx.aspx" file and "xxx.aspx.cs" file which implement an inherit class that holds all the events for the xxx.aspx controls.
Is it passable when calling rs.Execute( " xxx.aspx.cs", "To put here a member function of the class",………)???
Or you have an idea how to work this around???
Thanks again Ziv
|
|
|
|

|
it Me again sorry for the silly question Alvaro, i found out the answer.
RS.Execute( "xxx.aspx",.....)
instead of RS.Execute( "xxx.aspx.cs",...)
Ziv
|
|
|
|

|
I have taken the RS source code and packed it into another assembly. I have also combined the client-side javascript into this assembly.
When the if(AMS.Web.RemoteScripting.InvokeMethod(Page))return; is called it writes the clientside javascript nicely into the head of the calling document. (this is so you do not have to worry about where the client side script resides etc.)
I have also written a new function / method that is a one-stop-shop remote scripting call: (see below). It allows you to define all the information and class in one easy-to-use function:
Please it inside the client side javascript file...
============================================================
============================================================
function handleRemoteScripting()
{
rs="";
rs+="RS.Execute(\""+arguments[0]+"\",";
for(o=1;o<=arguments.length;o++)
{
switch(o)
{
case 1:{
rs+="\""+arguments[1]+"\",";
break;
}
case arguments.length:{
rs+="eval("+arguments[1]+")";
break;
}
default:{
rs+="\""+arguments[o]+"\",";
break;
}
}
}
rs+=")";
eval(rs);
}
===============================================================
===============================================================
usage:
handleRemoteScripting("Default.aspx","aFunctionOrMethod","Param1","Param2");
give the Callback the same name as the server-side method name:
Client-Side:
function aFunctionOrMethod(){alert(arguments[0]);}
Server-Side:
public string aFunctionOrMethod(String Param1, String Param2)
{return Param1+Param2; // or do something else}
on the client side call / usage: (arguments are as follows)
arguments 0 = the calling document (i.e. "Default.Aspx")
arguments 1 = the client-side function / server-side method-name
(i.e. "aFunctionOrMethod")
arguments 2 and greater are all parameters passed to the server-side public method. (i.e. "Param1", "Param2")
note:
return multiple results in a comma delimited string and split the results into and array within the callback function (client-side)
**
The new RS DLL will be available shortly (with permission from AM of course)
|
|
|
|

|
Howdy Alvaro,
Well, not sure how to convey so many thanks for your library. Maybe a big THANKS... but well, still not big enough. I'd even bring some flowers but hmmm maybe better not . Anyway, thanks for such a great library; and your writing style is excellent.
You reported on an earlier comment[^] that you preferred not to use POST since there were some reports that the IE progress bar was unreliable. I ran into the same, and after making sure I was using GET and still experiencing the same issue (more or less randomly), I digged a little longer and deeper.
I found a report from MS which put me on the right track, as it explains that when a behavior is dynamically attached to a page, the progress bar, well, basically just loses it. I traced the execution and found that if I insert a "windows.status='Done';" at the end of the setResult call (just below this.busy=false;), the problem would be gone, and the progress bar come back to its senses; for the time being, at least.
Note that if you use "window.status='';" ", as I wanted to, the problem remains; you have to use an actual string... sucks for other language browsers, but well, what the heck.
The MS article is: http://support.microsoft.com/kb/320731/en-us[^]
Again, thanks for the library, and everyone have a good one!
Andrés
|
|
|
|

|
Andrés
Thanks for your great comments and fix for that pesky progress bar issue.
I imagine by now you've switched over to some Ajax implementation. I've been using Anthem.NET with great satisfaction.
Regards,
Alvaro
Eat right. Exercise. Die anyway.
|
|
|
|
|

|
SpiritExplorer wrote: what is the advantage compare wtih ajax? ajax can do the same kind of work too
Honestly, I don't see any advantage. This just came out first, and it works across most platforms and browsers since it doesn't rely on the XMLHttpRequest component.
Use Ajax.
Regards,
Alvaro
The bible was written when people were even more stupid than they are today. Can you imagine that? - David Cross
|
|
|
|

|
Alvaro,
First of all, thank you for the code - it worked very smoothly for quite some time now.
I think there is a little bug: A remote method in the Page won't return "</textarea>" string back to the client. Try returning "</textarea> and then view result on the client: alert(result); - it will display an empty box.
Please confirm.
|
|
|
|

|
AndreiVM wrote: Try returning "</textarea> and then view result on the client: alert(result); - it will display an empty box.
Yep, that's because the result from the server is placed inside a textarea element.
Regards,
Alvaro
The bible was written when people were even more stupid than they are today. Can you imagine that? - David Cross
|
|
|
|

|
I am using your remote script and cannot refresh an asp.net table.. How can I do that??
|
|
|
|

|
ezztek wrote: I am using your remote script and cannot refresh an asp.net table.. How can I do that??
You'd have to do it programmatically with Javascript. I recommend you look at the Ajax implementations to see if they offer an easier solution.
Alvaro
The bible was written when people were even more stupid than they are today. Can you imagine that? - David Cross
|
|
|
|

|
Hi.. When i change the index of a dropdown List in my application that uses your Remote Scripting method i got the Error: 'RS' is undefined. i have added the Lines of code: <HTML> <HEAD> <title>WebForm1</title> <script language="javascript" src="/scripts/rs.js"> </script> <script language="javascript"> function dropdown_onchange() { RS.Execute("default.aspx","RemoteMethod","optionalparam1","optionalparam2",callback); } function callback(result) { return "The remote method returned:"+result; } </script>... So what could cause this error?
|
|
|
|

|
TheEagle wrote: So what could cause this error?
rs.js is not being loaded. Are you sure it's in the /scripts/ directory?
Regards,
Alvaro
The bible was written when people were even more stupid than they are today. Can you imagine that? - David Cross
|
|
|
|

|
Hi Alvaro
I'm coding a simple chat and i though i could your your fantastic rs ..
My question: is there any way to retrieve an array? or splitting a string is the only solution? in this case, what's the string limit? the 250 chars from the browser's address bar?
Saludos y gracias de antemano
Sebastian
|
|
|
|

|
Sebasg78 wrote: I'm coding a simple chat and i though i could your your fantastic rs
Thanks Sebastian.
These days Ajax is a better alternative. If you haven't already, I recommend you look at the available implementations. Anthem seems to be pretty good.
Sebasg78 wrote: My question: is there any way to retrieve an array? or splitting a string is the only solution? in this case, what's the string limit? the 250 chars from the browser's address bar?
Everything comes back as one string, so yes, you'd have to parse it. It's coming back from the server, so there's no size limit.
Saludos,
Alvaro
The bible was written when people were even more stupid than they are today. Can you imagine that? - David Cross
|
|
|
|
|

|
when i try to read the selected option of a drplist bounded with this tool the selected value is empty.
Gallina
|
|
|
|

|
lisandroc wrote: when i try to read the selected option of a drplist bounded with this tool the selected value is empty.
Read it from where, the client or server?
lisandroc wrote: Gallina
No seas.
Alvaro
The bible was written when people were even more stupid than they are today. Can you imagine that? - David Cross
|
|
|
|

|
Hi,
This is a terrific tool and we use it throughout our site. Recently a question came up that I could not answer: how does the remote scripting call to the server pass the sessionID and forms-authentication cookie so that when the call reaches the server it attaches to the correct session, etc? Does this question make sense? Is this something the browser handles before calling the page_load event (and the AMS.Web.RemoteScripting.InvokeMethod(Page) call)? Or are you doing it in your dll?
thanks -- john
|
|
|
|

|
JTW2 wrote: are you doing it in your dll?
I'm not doing a thing.
Whenever the remote method is called, the browser (via a hidden frame) accesses a page on your site and sends down all the cookies (where the Session ID is kept).
Regards,
Alvaro
... since we've descended to name calling, I'm thinking you're about twenty pounds of troll droppings in a ten pound bag. - Vincent Reynolds
|
|
|
|

|
Hi Alvaro,
I'm just wondering if this works with Safari?
Thanks!
|
|
|
|

|
GlenSpam wrote: I'm just wondering if this works with Safari?
I haven't tried it, have you? Point your Safari browser here[^] and let me know.
Regards,
Alvaro
... now you see that evil will always triumph because good is dumb. - Dark Helmet
|
|
|
|

|
Hi Alvaro,
Thank you for your response. I tried the link and it does not work with Safari. You can change the drop down but the salary does not load up - only when you click on the button and the page refreshes do the values become available. I think it might be when rs.js is initiated it 'sniffs' the browser type and does some settings for that browser. Javascript seems to think Safari is MOZ! Not sure what to do (apart from not use Safari!)?
Cheers,
Glen.
|
|
|
|

|
I've used it in Safari - I don't remember needing to make any changes to rs bits - though some other cross browser components weren't quite as cross browser as they might have been
HTH
James
|
|
|
|

|
Hi, I saw and donwload the sample and i like to know how to get the value of a function's dll, i'm working in VB .NET and ASP .NET, i never used the JScript or C# plz hlp me
|
|
|
|

|
Add a public method to your page that calls your DLL's method. This will be your remote method which you can then call from JavaScript, like in the sample.
Regards,
Alvaro
|
|
|
|

|
Hi,
I am trying to pass a french string to the remote scripting method. On the client side, the string is stored correctly, but when it arrives at the server side, the characters with accent are distorted. Is there a fix for this? Does it work with Unicode characters.
Thanks
|
|
|
|

|
Hi,
I was able to reproduce the problem. It's unfortunate that when the QueryString does not get properly decoded on the server, as it should be. To make it work, I had to actually parse the RawURL!
To make the fix, go to line 357 of RemoteScripting.cs, where the Arguments property is, and replace it with the following code:
public override string[] Arguments
{
get
{
int paramCount = 0;
while (m_page.Request["P" + paramCount] != null)
paramCount++;
string[] args = new string[paramCount];
string url = m_page.Request.RawUrl;
if (url.IndexOf("P0=[") < 0)
url = null;
for (int i = 0, start = 0; i < paramCount; i++)
{
if (url == null)
{
args[i] = m_page.Request["P" + i];
args[i] = args[i].Substring(1, args[i].Length - 2);
continue;
}
start = url.IndexOf("P" + i + "=[", start + 1);
if (start < 0)
{
args[i] = null;
continue;
}
start = url.IndexOf("[", start) + 1;
int end = url.IndexOf("]", start);
if (end < 0)
end = url.Length;
args[i] = DecodeUrl(url.Substring(start, end - start));
}
return args;
}
}
private static string DecodeUrl(string url)
{
StringBuilder result = new StringBuilder();
for (int i = 0; i < url.Length; i++)
{
char c = url[i];
if (c == '%')
{
c = Convert.ToChar(Convert.ToInt16(url.Substring(i + 1, 2), 16));
i += 2;
}
result.Append(c);
}
return result.ToString();
}
That fixes the problem. (I couldn't even use HttpServerUtility.DecodeUrl to parse the arguments; I had to write my own.)
I'll include this in a future update.
Thanks,
Alvaro
|
|
|
|

|
Thank you very much. I appreciate it. I also managed to fix the problem by changing the posting mode to POST instead of GET.
My best regards
|
|
|
|

|
emadns wrote: I also managed to fix the problem by changing the posting mode to POST instead of GET.
Yes, I noticed that too.
Unfortunately using POST sometimes causes the IE browser to not remove the progress bar from the status bar, as if the page is still loading. And using GET avoids that issue.
Regards,
Alvaro
|
|
|
|

|
I get Permission Denied when trying to execute a script that is on a server different than the original page. I believe the issue has to do with cross-site scripting permissions, but I still have to make this work somehow. I tried setting document.domain property in various places, but could not make it to work. Any suggestions?
Sanin
-- modified at 17:45 Tuesday 3rd January, 2006
|
|
|
|

|
I don't know what the problem could be, but someone may have run into it in the past. Have you looked at the comments on this forum?
Regards,
Alvaro
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
|
Use client-side JavaScript to remotely invoke methods in ASP.NET pages.
| Type | Article |
| Licence | |
| First Posted | 15 Mar 2004 |
| Views | 476,164 |
| Bookmarked | 193 times |
|
|