转发器控制中的javascript函数 [英] javascript function in repeater control

查看:50
本文介绍了转发器控制中的javascript函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,



我想在点击按钮时调用转发器控制中的JavaScript功能。



如果有可能请回复



谢谢......

Dear all,

I want to call JavaScript function in repeater control on button click.

If it is possible please reply

Thank......

推荐答案

如果你的意思是客户端点击,这是可能的。假设你在转发器的 ItemTemplate 中有这个。
If you mean client click, it is possible. Lets say you have this in the ItemTemplate on your repeater
<asp:Button runat="server" ID="btnSave" Text="save" />



在转发器控件的 ItemDataBound 事件中,添加此


On the ItemDataBound event of your repeater control, add this

Button saveBtn = (Button)e.Item.FindControl("btnSave");
saveBtn.Attributes.Add("onclick", "[Your Javascript Function here]");


http://stackoverflow.com/questions/1570329/jquery-dialog-and-asp-net-repeater [ ^ ]



http://forums.asp.net/t/1670911 .aspx / 1 [ ^ ]



我希望以上信息对您有所帮助。如果您有更多疑虑,请告诉我。
http://stackoverflow.com/questions/1570329/jquery-dialog-and-asp-net-repeater[^]

http://forums.asp.net/t/1670911.aspx/1[^]

I hope the above information will be helpful. If you have more concerns, please let me know.


谢谢大家,



我试过这个,我明白了。 ..



Thank you guys,

I tried this, i got it...

if (e.CommandName == "Edit")
        {
            ImageButton btnedit = (ImageButton)e.Item.FindControl("imgEdit");
            string[] cmdArgs = e.CommandArgument.ToString().Split(new char[] { ',' });
            String strJSFunctionCall = String.Format("GetAlt({0},{1},{2})", cmdArgs[0], "'"+cmdArgs[1]+"'", 0);
            btnedit.Attributes.Add("onclick", strJSFunctionCall);
        }





当我为字符串添加引号时它开始工作。



再次感谢大家。



its started working when i placed quotes for string.

Thanks Once Again everyone.


这篇关于转发器控制中的javascript函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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