|
The page refresh when you click the submit button, but when you change the select make a Remote Scripting to fill the other
|
|
|
|
|
The page does not really refresh. What refreshes is hidden IFRAME element in the page which does a postback to the page with with the remote method. Unfortunately this cause the status bar to behave as if the whole page was refreshing when only the IFRAME is doing so.
Regards,
Alvaro
Victory means exit strategy, and it's important for the President to explain to us what the exit strategy is. -- GWB, 1999.
|
|
|
|
|
Hi,
I use your remotescripting blog. But sametime i receive this error message :
"'options' is null or not an object".
When i use script debugger, application stoped in rs.js, while rows.
RemoteScripting.prototype.ReplaceOptions = function(element, optionsHTML)
{
// Remove any existing options
while (element.options.length > 0)
element.options[0] = null;
In this state, element and options is null
have u ever received this message ??
Thanks
Mehmet
|
|
|
|
|
Hi Mehmet,
Make sure when you call ReplaceOptions that element is a valid object of type select . In other words, it must refer to an existing dropdown list in your form, otherwise you'll receive the error.
Regards,
Alvaro
Victory means exit strategy, and it's important for the President to explain to us what the exit strategy is. -- GWB, 1999.
|
|
|
|
|
I have this exception:
Message "No se puede encontrar el miembro."
StackTrace " at System.DefaultBinder.BindToMethod(BindingFlags bindingAttr, MethodBase[] match, Object[]& args, ParameterModifier[] modifiers, CultureInfo cultureInfo, String[] names, Object& state)\r\n at System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters)\r\n at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args)\r\n at AMS.Web.RemoteScriptingClient.InvokeMethod() in c:\\documents and settings\\mllanos\\escritorio\\remotescriptingsourceandbinaries\\remotescripting\\remotescripting.cs:line 265"
Is this a bug? Thank you!
PD: Do you speak spanish???
Martín
|
|
|
|
|
Hola Martín,
This problem is caused when the remote method (or property) cannot be found. There may be several reasons:
1. The method has not been defined in your class (or control).
2. The method is not public .
3. The method's parameters are incompatible with the way it's being called by the client. Verify all the parameters are there, and they're all of type string .
Saludos,
Alvaro
Victory means exit strategy, and it's important for the President to explain to us what the exit strategy is. -- GWB, 1999.
|
|
|
|
|
we found this problem trying to test your examples, if you have any suggestion, becouse we didn't change the code, would be very helpfull.
Excuse my English
Isidoro
|
|
|
|
|
Hello Isidoro,
Please make sure you've downloaded the latest code and verify that the demo works on your server.
Regards,
Alvaro
Victory means exit strategy, and it's important for the President to explain to us what the exit strategy is. -- GWB, 1999.
|
|
|
|
|
Hi, I'm with Isidoro trying to understand why this example dont'n works as well as it works in your server.
We just make it works but when I change the first select, it throw this exception:
System.MissingMethodException: No se puede encontrar el miembro.
at System.DefaultBinder.BindToMethod(BindingFlags bindingAttr, MethodBase[] match, Object[]& args, ParameterModifier[] modifiers,
CultureInfo cultureInfo, String[] names, Object& state)
at System.RuntimeType.InvokeMember(String name, BindindgFlags invokeAttr, Binder binder, Object target, Object[] args,
ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters)
at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target,
at AMS.Web.RemoteScriptingClient.InvokeMethod()
I click Acept and then it works well until I change the select again!
I hope you can help us!
Martín
|
|
|
|
|
I don't understand what the problem is. Is there a chance you can send me a copy of your project?
Thanks,
Alvaro
Victory means exit strategy, and it's important for the President to explain to us what the exit strategy is. -- GWB, 1999.
|
|
|
|
|
If you change the second parameter of the UpdateAmounts method to be a string rather than an int, then the problem goes away. The article mentions that the parameters of the remote method must be strings, but the sample has one of type int.
Hope this fixes your problem
J8B.
|
|
|
|
|
|
I'm sorry, but I hadn't realized that the demo still had a bug in it. I had submitted a fixed version to CodeProject a while back and thought they had updated it already. I never bother to download the code to verify it, and that's my fault.
Regards,
Alvaro
Victory means exit strategy, and it's important for the President to explain to us what the exit strategy is. -- GWB, 1999.
|
|
|
|
|
If the problem is that somebody "No se puede encontrar el miembro", well, I'd say that's not a bug, that's an extremely serious problem, and a doctor should be consulted inmediatelly
Alvaro, I have used the WebServices behavior with IExplorer and looks very easy to use (but is only for IExplorer). Have you evaluated it? How would it compare with RemoteScripting?
Best regards,
Julio
|
|
|
|
|
julio361 wrote:
If the problem is that somebody "No se puede encontrar el miembro", well, I'd say that's not a bug, that's an extremely serious problem, and a doctor should be consulted inmediatelly
Brings back memory of Lorena Bobbitt.
julio361 wrote:
Alvaro, I have used the WebServices behavior with IExplorer and looks very easy to use (but is only for IExplorer). Have you evaluated it? How would it compare with RemoteScripting?
I haven't actually. But I guess the greatest advantage of RemoteScripting is that it works across a variety of browsers. It's also pretty easy to use, I think.
Regards,
Alvaro
Victory means exit strategy, and it's important for the President to explain to us what the exit strategy is. -- GWB, 1999.
|
|
|
|
|
Hi,
First of all, thanks for the control. Very nice job.
I'm trying to use Remote Scripting with DotNetNuke, within an ASCX (module) file, to load a method from this control. But the methods are never executed, because the in the DNN exists only one web page that dinamically loads usercontrols.
Is it possible?
Thanks,
Catalin
|
|
|
|
|
Catalin MAICAN wrote:
First of all, thanks for the control. Very nice job.
Thanks!
Catalin MAICAN wrote:
I'm trying to use Remote Scripting with DotNetNuke, within an ASCX (module) file, to load a method from this control. But the methods are never executed, because the in the DNN exists only one web page that dinamically loads usercontrols.
Is it possible?
It should be. Simply call AMS.RemoteScripting.InvokeMethod after your user control has been loaded.
Regards,
Alvaro
Victory means exit strategy, and it's important for the President to explain to us what the exit strategy is. -- GWB, 1999.
|
|
|
|
|
Hi,
thanks for your answer, but still no luck.
I tried with
- RS.Execute(FullURL, MethodToInvoke, ....)
- RS.Execute(FullURL, UserControl.MethodToInvoke, ....)
I think that the AMS.RemoteScripting.InvokeMethod method does not find method within the UserControl. I played a liite with your code and listed all the Members, Fields, Methods that are found. And the code finds only those one in the Page, not within the UC.
Any suggestions?
Thanks,
Catalin
|
|
|
|
|
Here's what I would do:
1. Call RS.Execute("yourPage.aspx", "PublicMethodInYourPage", ...)
2. In your page, after your UserControl has been loaded, call AMS.RemoteScripting.InvokeMethod(Page) , like I show in the article.
3. Add the PublicMethodInYourPage to your page, like this:
public string PublicMethodInYourPage(...)
{
UserControl uc = GetControlThatYouveAlreadyLoaded();
return uc.SomeMethod():
}
That should do it.
Regards,
Alvaro
Victory means exit strategy, and it's important for the President to explain to us what the exit strategy is. -- GWB, 1999.
|
|
|
|
|
Very, very nice work! I love the idea of not having to refresh the page when populating a series of list controls.
The problem I'm running into however is in regards to the following scenario:
I have the ListBox controls on the page--very standard process--second list is populated based on selection in first, third list is populated based on selection in the first 2. No problems with populating the lists, that went very smoothly. The issue I am having is that when a selection is made in the third list I am executing a remote scripting call that passes the selected values of all 3 lists. In the codebehind the remote method that is called uses the 3 selected values to retrieve a record from the database, and then sets the content of the controls (a r.a.d. editor control, dropdownlist, another editor, and custom control) on the server and then simply returns. The controls were not reflecting the content that was inserted, which of course is because a "true" postback was not performed. So I changed the third list to AutoPostback=true and wired up a SelectedIndexChanged event to retrieve the record and insert the values on the server, but when the page refreshes the changes are not persisted...any suggestions?
|
|
|
|
|
I think you're having ViewState issues with your listbox controls.
If I'm right, when SelectedIndexChanged gets called, your listboxes are automatically repopulated based on the ViewState and they get set back to their original values. If this is the problem, here's the solution:
1. Set the last two listboxes' EnableViewState flag to false.
1. Populate them on every trip to the server.
3. Set their selected value based on the Request.
I mention this problem in the article and it's reflected in the rsDemo.aspx file. Take a look at how I handle the amount dropdown inside Page_Load -- it's populated every time.
Regards,
Alvaro
Victory means exit strategy, and it's important for the President to explain to us what the exit strategy is. -- GWB, 1999.
|
|
|
|
|
I was probably not clear enough, but my problem is not with the items collections not being persisted for the listboxes, but with some values that I set inside of the remote method I am calling from that third listbox. For example, this is the remote method code (abbreviated, of course):
<code>public string PopulateQuestionData_RM(string selectedExam, string selectedQuestion)
{
int examId = Convert.ToInt32(selectedExam);
int questionId = Convert.ToInt32(selectedQuestion);
QuestionEntity currentQuestion = RetrieveQuestion(examId, questionId);
txtQuestionText.Text = currentQuestion.Body;
txtQuestionExplanation.Text = currentQuestion.Explanation;
cbIsCorrect.Checked = currentQuestion.IsCorrect;
return "Loaded";
}
</code>
Is there a way, using only the remote scripting call, to set those values on the server and have them persisted? For example, I would of course need to set the values in the remote method as I am doing above, and also return the values to the callback and set them on the client and if the user modifies them, etc and clicks the 'Save' button (causing a postback) those control values will be available server-side. Is this possible/feasible?
|
|
|
|
|
Larkin wrote:
Is there a way, using only the remote scripting call, to set those values on the server and have them persisted?
I don't know what you mean by "have them persisted". The only thing the web server persists are Session and Application variables. Everything else is discarded as soon as the response is sent back to the client.
Larkin wrote:
For example, I would of course need to set the values in the remote method as I am doing above
No. All you need to do is return the values for those controls concatenated inside a string that you can then parse on the client.
Again, if you need to persist anything on the server, use the Session object.
Regards,
Alvaro
Victory means exit strategy, and it's important for the President to explain to us what the exit strategy is. -- GWB, 1999.
|
|
|
|
|
First of all, I would like to thank u a lot for this : it has been really helpful and valuable for a MSN - chat/relay I've been putting on our web site.
2nd, it looks that there is a bug in the JS component (rs.js). to compose a URL, in case of using the GET method to invoke the remote proc, u use the javascript 'escape' function, when you should use the encodeURIComponent. The result is that some special caracters (like accents in french and the + signs) are lost.
I've been changing this and it fixes my issue.
Thank's again.
Best Regards.
Chic
|
|
|
|
|
ZeChic wrote:
I've been changing this and it fixes my issue.
That's great! Please post the fix so we can all benefit. I'll be sure to add it to a future update.
Thanks,
Alvaro
Victory means exit strategy, and it's important for the President to explain to us what the exit strategy is. -- GWB, 1999.
|
|
|
|
|