如何处理linkbutton [英] how handel linkbutton clik

查看:82
本文介绍了如何处理linkbutton的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想制作3个linkedButton
例如
1-红色
2蓝
3-黑色

如果用户选择红色,则文本前景色将为红色
我的问题:如何处理linkbutton clik

i want to make 3 linkedButton
for example
1-Red
2-Blue
3-Black

if user choose Red , text forecolor will be Red
My Question : how handel linkbutton clik

推荐答案

有几种方法可以解决此问题:
使用Javascript:只需向每个链接添加onClick处理程序,然后使用javascript函数来更新您要更新的对象的样式.
There are a couple ways to handle this:
Using Javascript: Just add an onClick handler to each link and then use a javascript function to update the style of the object you wish to update.
function onClickHandler(controlToChangeColorOn, colorToUse) {
   var controlObj = document.getElementById(controlToChangeColorOn);
   controlObj.style.color = colorToUse;
}


在后面使用代码:只需使用在asp:LinkBut​​ton对象上定义的Click处理程序,然后在后面的代码中的click处理程序中设置所需的颜色即可.


Using Code Behind: Just use the Click handler defined on the asp:LinkButton object and then in the click handler in the code behind set the color that you want.

protected void LinkButton_Command(Object sender, CommandEventArgs e) 
{
   YourControlToUpdateColorOn.Style.Add("color", "#000000");
}


如果您不知道如何处理,请尝试 bach .请参阅:
http://en.wikipedia.org/wiki/Handel [ http://en.wikipedia.org/wiki/Johann_Sebastian_Bach [
If you don''t know how to handel it, try to bach it. Please see:
http://en.wikipedia.org/wiki/Handel[^],
http://en.wikipedia.org/wiki/Johann_Sebastian_Bach[^].

Please keep in mind that if you neglect spelling, the compilers won''t be able to understand you. :-)

Good luck,
—SA


在此处查看:

这篇关于如何处理linkbutton的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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