Click here to Skip to main content
15,886,724 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
As suggested by Mark, I created a JS popup using div (with css of course), with a table with two rows and two columns

XML
<input id='jsconfirmleft' type='button' value='Standard' onclick='criarNota(1)' onfocus='if(this.blur)this.blur()'>"+
                    "&nbsp;&nbsp;"+
                    "<input id='jsconfirmright' type='button' value='Azul' onclick='criarNota(2)' onfocus='if(this.blur)this.blur()'>"+
                    "&nbsp;&nbsp;"+

.....


My problem is: the value I pass on criarNota (1,2 ...) i manage it this way

C#
function criarNota(cor) { // cor e um inteiro

 PageMethods.verID(result);
            }



and then

C#
function result(id)
{
    if(id == -2) // n sao permitidas mais notas
  ........


      jQuery.fn.stickyNotes.createNote(id+1,HERE!!!!);
}


dont get confused verID are two functions one to server side other to client side.

The problem is, I need to get that 'cor' variable value to createNote function.

Under this situation, how can I accomplish that? Is it possible that the only solution is to send the 'cor' value to server and then send it back to client side ? I need an efficient solution, and I'm wondering how could I do that :doh:
Posted
Updated 5-Jan-11 14:18pm
v4
Comments
Maxdd 7 5-Jan-11 20:07pm    
Maybe using cookies ?

Or there is a basic solution to pass that variable ?

1 solution

"verID are two functions one to server side other to client side."

This is a mess. Use different names.

Create a JavaScript variable to hold the value passed in to the criarNota function and read it in the verID function. It isn't that difficult of a concept.

I do hope you finish this project soon so you can spend the time you should have to actually learn what you are doing.

C#
var someVariable;


function criarNota(cor) 
{ 
   someVariable = cor;
   PageMethods.verID(result);
}

function result(id)
{
    if(id == -2)
  ........

      jQuery.fn.stickyNotes.createNote(id+1, someVariable);
}
 
Share this answer
 
v3
Comments
Maxdd 7 5-Jan-11 20:22pm    
I like my mess :), but I changed because I'm about to make a question that would be confusing if I didnt do it.

On topic, I'm not understanding your answer. The value passed "in to" ? English is not my native language, so I really cant understand that.

Can you please clarify ?
Maxdd 7 5-Jan-11 20:52pm    
You seriously have to stop "talking" as you know who you are talking about.

If you think I deserve to be helped, and you want to help, help. If you dont, dont answer, you dont help anything nor anyone with those kind of comments. For a respected member as you, it's sad see those kind of comments.

On topic, yes it was a stupid question. I didnt know that JS could hold "global variables". Probably that is one page five on that book you told me to read
[no name] 5-Jan-11 21:12pm    
I usually don't look at who posted the question, but I will now
Maxdd 7 5-Jan-11 21:37pm    
That's not true, You referenced me and my stumbling many times. But it's ok Mark.

Honestly I didnt liked what you said, altough I really appreciate your help and patient.
[no name] 5-Jan-11 22:05pm    
I did say "usually". It is very frustrating to see repeated questions where you know the answer is right in front of the person, if they would only look.

But I'll tell you what, as a gesture to help you learn the proper way, contact me directly.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900