[CLOSED] Direct Events - Pass string / message to client

  1. #1

    [CLOSED] Direct Events - Pass string / message to client

    Hi i have used following Directevent in my MVC razor view engine appilcation.

    .DirectEvents(de =>
                                                        {
                                                            de.Click.Url = Url.Action("HandleChanges");
                                                            de.Click.ExtraParams.Add(new Parameter
                                                            {
                                                                Name = "data",
                                                                Value = "#{Store}.getChangedData()",
                                                                Mode = ParameterMode.Raw,
                                                                Encode = true
                                                            }
                                                                                    );
                                                            de.Click.ExtraParams.Add(new Parameter
                                                            {
                                                                Name = "scenarioId",
                                                                Value = Model.SID.ToString(),
                                                                Mode = ParameterMode.Raw,
                                                                Encode = true
                                                            }
                                                                                    );                                                      
                                                        }
                                                                     )
    Form the code behind on a condition i have to return a string to the client side.

    How to pass this string in the return statement?
    How to catch this statement at client side?
    How to call a javascript function so as to pass this string?
    Last edited by Daniil; Aug 26, 2013 at 1:03 PM. Reason: [CLOSED]
  2. #2
    Hi @PriceRightHTML5team,

    What about this?
    X.Js.Call("functionName", "the string");
    It should be called within a controller action of DirectEvent.
  3. #3
    Hi
    X.Js.Call("functionName", "the string");
    works fine when i call a function which has a simple alert() in it. But when i calling a external javascript function (which is my requirement) it gives js error saying function not found.

    I have external css to applied for that js function

    How to achive this?
  4. #4
    Quote Originally Posted by PriceRightHTML5team View Post
    it gives js error saying function not found.
    Is that function defined on the page? Please demonstrate how.

    Quote Originally Posted by PriceRightHTML5team View Post
    I have external css to applied for that js function
    Sorry, I do not understand it well. Please elaborate.
  5. #5
    Hi,
    I placed following code in my controller's action method

    X.Js.Call("ShowMessage", "invalid data");
    here ShowMessage is a js function defined in CommonJavascript.js

    it gives js error saying "function not found."
  6. #6
    It means that the CommonJavascript.js is not loaded yet. Where is it defined?

    A full test case is appreciated.
  7. #7
    CommonJavascript.js is in the Scripts folder of Asp.net MVC webproject
  8. #8
    Good.

    How do you attach it to the page?
  9. #9
    The reference to that specific js was missing.

    Now it is working fine.

    Thanks for pointing it out.

Similar Threads

  1. Replies: 11
    Last Post: Aug 14, 2013, 5:06 PM
  2. RadioGroup .. Direct Events
    By rookie in forum 2.x Help
    Replies: 1
    Last Post: Dec 06, 2012, 3:02 PM
  3. Replies: 0
    Last Post: Oct 12, 2012, 3:46 PM
  4. [CLOSED] how to pass combobox values through direct methods
    By dev in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Sep 08, 2010, 3:54 AM
  5. Replies: 4
    Last Post: Jul 17, 2010, 8:21 AM

Tags for this Thread

Posting Permissions