如何使用javascript获取当前listviewitem的值 [英] How to get the value of a current listviewitem using javascript

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

问题描述

我想在javascript中获取基于id的listview的值,并且我将获得modalpopupextender内容的值



我有什么试过:



我试过了

var result = document.getElementById(ctl00_MainContent_checkList1_ctrl1_lblID)。value;



以及



alert(document.getElementById(ctl00_MainContent_checkList1_ctrl1_lblID));

I want to get the value of the listview based on id in javascript and with the value I will get the contents inside modalpopupextender

What I have tried:

I have tried
var result = document.getElementById("ctl00_MainContent_checkList1_ctrl1_lblID").value;

and also,

alert(document.getElementById("ctl00_MainContent_checkList1_ctrl1_lblID"));

推荐答案

这不是获取id的合适方式。 id
This is not the appropriate way of getting id. The id
ctl00_MainContent_checkList1_ctrl1_lblID

是服务器生成的id。它可以在不同的服务器上更改。所以你应该做以下步骤





is server generated id. It could change on different servers. So you should do the following steps


var result = document.getElementById('<%=CHeckList.ClientID %>').value;





在Above<%= CHeckList.ClientID%>你必须写下你的标签ID。



In the Above <%=CHeckList.ClientID%> you have to write your label id.


这篇关于如何使用javascript获取当前listviewitem的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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