网格内的访问文本框ID [英] Acess textbox id inside the grid

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

问题描述

大家好,

我在网格内有一个文本框,而该网格在usercontrol内.在这种情况下,如何访问Javascript

Hi all,

I have a textbox inside the grid and that grid is inside the usercontrol. in that case how can i access the textbox id in Javascript

推荐答案

中的文本框ID,您需要通过其ClientID获取文本框.
浏览以下链接以完成任务.
如何在JQuery中访问ASP.NET控件客户端ID [访问其他TD中控件的ClientID [ ^ ]
从JQuery访问文本框 [
You need to get the textbox by its ClientID.
Go through the below links to do your task.
How to Access ASP.NET Controls client id in JQuery[^].
Accessing ClientID of a Control in a different TD[^]
Access Textbox from JQuery[^]


文本框是服务器控件,您无法访问它直接带有文本框ID.

原因是处理后发送给用户的任何Web控件都是html,如果您看到源,则ID会更改.

试试这个

The Textbox is a server control and you cannot access it directly with the text box id.

The reason is any web control when processed and send back to user is a html and if you see the source, the id is changed.

Try this

var obj = document.getElementById("<%= textbox1.ClientID %>)
alert(obj.value);



希望这会有所帮助.
欢呼



Hope this helps.
cheers


对网格视图使用RowCommand事件.
use RowCommand event for the grid view.


这篇关于网格内的访问文本框ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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