0

I would like to interact with object that has many of objects and also methods.

    class Question
    {
       Boolean IsVisible;
    }    
    class Exam
        {
           public 

list<Question> questions;
       getShowenBs()
       {
             //piece of code
       }
       getHiddenBs()
       {
            //piece of code
       }


    }

From aspx page I want to only go to server side to get exam object with all questions at the first time then accoroding to answer for specific question ,some questions will appear and other will disappear and I don't need to go to server side again .Now I want to show and hide using the methods inside Exam object.I got from my friends that Sencha , Prototype and JSON can do that.Is it correct and are there can also call methods inside exam object without going to server side?

All ideas are welcomed and you can modify any thing except going to server side twice

I hope it be clear and feel free to ask me for anything

3
  • Can you clarify what you mean by call methods inside exam object without going to server side? Your Exam class is implemented on the server. You can expose web services in order to call its methods from the client side, but that still counts as going to server side IMHO... Commented Apr 6, 2011 at 18:54
  • @Frederic : I really don't know how !!! but I need to hide some questions and show others without going to server side if you have any suggestion you can Commented Apr 6, 2011 at 19:00
  • See this answer for example of manually "converting" server side collection to client side array.. in your case it's List instead of enum but the logic is the same. Commented Apr 6, 2011 at 19:06

2 Answers 2

1

You need to serialize all these questions to JSON on the server. You cannot pass logic between the server and the client, so you will have to implement the logic on the client in JavaScript.

Sign up to request clarification or add additional context in comments.

1 Comment

So I should implement method on client side
0

Just use ajax to call a [WebMethod] on the server.

[WebMethod]
public static Dictionary<String, String> myWebMethod(string arg1, string arg2, ...) {

}

Then just use a $.ajax call to "url/myaspx.aspx/myWebMethod" with the correct parameters. You can handle the returned dictionary in your callback.

2 Comments

So I will create web service at server
@thabet084 Well kind of. It's more allowing the client to call a C# method. Just add it to one of your classes and call it from the client

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.