如何从javascript代码中获取价值并将其传递给C#代码进行测试 [英] How to get value from javascript code and pass it to C# code to test it

查看:71
本文介绍了如何从javascript代码中获取价值并将其传递给C#代码进行测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

全部问候,

我有一个问题需要从javascript代码中检索一个值,我需要这个值来测试我的c#代码。

我有两个复选框:

Greeting All ,
I have a problem to retreive a value from javascript code , I need this value to test it on my c# code .
I have two checkboxes :

<ul id="childCheckBox">
     <a id ="page" href="#"><input id="onPage" type="checkbox" class="childCheckBox" value="#" />@ApplicationResources.PostOnPage</a>
     <a id ="mur" href="#"><input id="onWall" type="checkbox" class="childCheckBox" value="#"/>@ApplicationResources.PostOnWall</a>
  </ul>
  </div>



如果选中第一个,将执行一个函数,如果第二个将被检查,那么另外一个函数将被执行。

如何测试哪一个被检查

这里id我的C#代码:


If the first is checked a function will be executed and if the second will be checked then an other function will be executed .
How can I test which one is checked
Here id my C# code :

var joboffer = manager.JobOffer.GetJobOfferById(id);

if (Test)

    FBEngine.PostJob(joboffer);
}
else
{
    FBEngine.PostJobOnWall(joboffer);
}



我需要帮助!

在此先感谢


I need Help please !
Thanks in advance

推荐答案

首先获取隐藏字段,设置它的值然后在服务器端访问它。
first you get hidden field ,set the value of it then access it on server side.


这篇关于如何从javascript代码中获取价值并将其传递给C#代码进行测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆