有没有办法在javascript中设置asp.net按钮的CommandArgument? [英] Is there a way to set a asp.net button's CommandArgument in javascript?

查看:382
本文介绍了有没有办法在javascript中设置asp.net按钮的CommandArgument?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个GridView,列出一堆物品和一列有一个显示模式(AjaxToolkit ModalPopupExtender)的链接。让我们称之为链接查看。在这个模式,我有一个ASP:按钮保存在该模式中输入的数据。让我们把那个按钮保存

I have a GridView that lists a bunch of items and one of the columns has a link that displays a modal (AjaxToolkit ModalPopupExtender). Let's call that link "Show". In that modal, I have a asp:button for saving the data entered in that modal. Let's call that button "Save"

所以,当在某一行中的显示链接,用户点击,我希望写一些JavaScript,设置东西保存按钮,这样在我的code-身后,我可以处理保存.Command并使用CommandEventArgs参数来获取值。

So when the user clicks on a "Show" link in a certain row, I'd like write some javascript that sets something in the "Save" button, so that in my code-behind, I can handle "Save".Command and use the CommandEventArgs parameter to get the value.

这是可能的,还是我只需要使用一个隐藏的输入标签并将其值设置?

Is this possible, or do I just need to use a hidden input tag and set its value?

推荐答案

好了,继续研究之后,它看起来像它无法做到的。的CommandArgument属性可能驻留在ViewState,但对于该情况下,完全是服务器端,不能使用JavaScript来改变。

Well, after continuing the research, it looks like it cannot be done. The CommandArgument property might reside in the ViewState, but for this case, it is completely server side and cannot be changed using javascript.

这篇关于有没有办法在javascript中设置asp.net按钮的CommandArgument?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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