获取文本框事件触发时的按钮客户端ID [英] get button client id on textbox event firing

查看:58
本文介绍了获取文本框事件触发时的按钮客户端ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我有一个文本框和2个按钮保存和搜索

我在文本框中输入了一些值按下搜索按钮默认值工作是保存

所以我阻止默认按钮....但我没有在文本上获取搜索按钮客户端ID

使用javascript改变事件..如果geting null .. ...如何获取客户端ID

i使用document.getElementById(''id'')。ClientID为此目的任何想法

Hi,

I have a textbox and 2 button save and search
while am entered some value in textbox press search button default working is save
so i prevent default button....but am not getting search button client id on the text
change event using javascript..its geting null.....how to get client id
i used document.getElementById(''id'').ClientID for this purpose any idea

推荐答案

HI,



您可以通过两种方式获得clientID。



1.


You can get the clientID in 2 ways.

1.


#btnSearch

- 如果您使用的是母版页,这将有效。它将搜索以IDbtnSearch结尾的控件ID。



2.将控件属性设置为

-- This will work aleays if you are using the master page or not It will search for the control ID ending with the ID "btnSearch".

2. Make the control property as

ClientIDMode="Static"

然后使用获得上述控件之类的控件离子或

and then use to get the control like the above potion or

document.getElementById(''btnSearch'')



这样可行。



谢谢


This will work.

Thanks


您的问题不明白。

但是通过将表格的defaultbutton属性设置为searchbutton可能会对你有帮助。



Your Question is not clear to understand.
But by setting defaultbutton property of form to searchbutton will may help u.

<form id="form1" runat="server"   defaultfocus="txt1" defaultbutton="btnsearch">


这篇关于获取文本框事件触发时的按钮客户端ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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