How can we access values from javascript fn into Codebehind?

Posted by Ssjganesh under C# on 12/31/2011 | Points: 10 | Views : 5550 | Status : [Member] | Replies : 2
Ad.Happy New year guys!

I have created a dynamic <Span> in Javascript like.,

function assignMembersName()

{

var dynamicSpan = document.createElement("span");

var strMembersName = membersName.options[membersName.selectedIndex].text;
var strMembersId = membersName.options[membersName.selectedIndex].value;
dynamicSpan.name = 'span' + strMembersId; --------Dynamic id comes from codebehind

dynamicSpan.value = strMembersName; ----------Dynamic values comes from codebehind

var td = document.getElementById('tdDynamic').innerText = document.getElementById('tdDynamic').innerText +

',' + dynamicSpan.value;

}

Now I need to set classname for that all created span and sholud stored in a variable at codebehind,

bcoz, the values generated by the dynamic span should be insert into Sqlserver table,

so i need to send these values as a parameter.

How can i access the span values in code behind?




Responses

Posted by: Sksamantaray on: 12/31/2011 [Member] Silver | Points: 25

Up
0
Down
http://www.codeproject.com/Questions/228944/Can-i-get-value-from-javascript-in-Csharp-code-beh
This link may help you.

Thanks,
Sanjay

Ssjganesh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Blessyjees on: 1/1/2012 [Member] Bronze | Points: 25

Up
0
Down
Hi,

If you will set runat="server" property to span. You can get this control in code behind.

Blessy Baby
Digitalmesh Softech pvt Ltd
https://blessybaby.wordpress.com/

Ssjganesh, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response