5 Replies - 5239 Views - Last Post: 08 October 2009 - 03:37 AM Rate Topic: -----

#1 -Muc_   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 06-October 09

Return Values from Javascript to C#

Posted 06 October 2009 - 02:35 AM

I have a hidden field where I assigns the values, but I can not access to this value in c #


<asp:HiddenField ID="hhidAcrobat" runat="Server" />

 function GetAllChecked() {
			var checkboxes = document.getElementsByName("skill");
			var s = ""

			for (var i = 0; i < checkboxes.length; i++)
				if (checkboxes[i].checked)
					s += checkboxes[i].value + ";"
			  ;
			  ;
				document.getElementById('hhidAcrobat').value = s;
			alert("Ajax ... " + s);
		}

This post has been edited by -Muc_: 06 October 2009 - 02:36 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Return Values from Javascript to C#

#2 eclipsed4utoo   User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1535
  • View blog
  • Posts: 5,972
  • Joined: 21-March 08

Re: Return Values from Javascript to C#

Posted 06 October 2009 - 05:23 AM

the server side code doesn't see the change to the value of the hidden control.

you can communicate from javascript to the code behind by doing PageMethods...

http://forums.asp.ne...38.aspx#2612038
Was This Post Helpful? 0
  • +
  • -

#3 -Muc_   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 06-October 09

Re: Return Values from Javascript to C#

Posted 06 October 2009 - 08:19 AM

Hmm OK, but my field is not supposed to be visible! At runtime, when the user clicks a checkbox Ajax will be called to update the one part of area
Was This Post Helpful? 0
  • +
  • -

#4 eclipsed4utoo   User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1535
  • View blog
  • Posts: 5,972
  • Joined: 21-March 08

Re: Return Values from Javascript to C#

Posted 07 October 2009 - 04:38 AM

View Post-Muc_, on 6 Oct, 2009 - 11:19 AM, said:

Hmm OK, but my field is not supposed to be visible! At runtime, when the user clicks a checkbox Ajax will be called to update the one part of area


do you mean the hidden control is being shown on the form?
Was This Post Helpful? 0
  • +
  • -

#5 -Muc_   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 06-October 09

Re: Return Values from Javascript to C#

Posted 08 October 2009 - 02:08 AM

what I really want is to read the form and passed checked values to the server. Which should happen without any click on a button but when i click the checkbox.

This post has been edited by -Muc_: 08 October 2009 - 02:09 AM

Was This Post Helpful? 0
  • +
  • -

#6 eclipsed4utoo   User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1535
  • View blog
  • Posts: 5,972
  • Joined: 21-March 08

Re: Return Values from Javascript to C#

Posted 08 October 2009 - 03:37 AM

Why don't you use the checkchanged event for the checkbox. Don't forget to set the Autopostback property to true.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1