在访问ASP控件时遇到问题 [英] Having problems getting access to ASP Controls

查看:73
本文介绍了在访问ASP控件时遇到问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很抱歉,这是一个愚蠢的基本问题.但是我真的不知道如何解决这个问题.我有ASP控件(一个文本框和一个下拉列表).现在,我需要访问TextBox的value属性以及下拉列表的SelectedIndex属性.这应该很简单:
用于TextBox:

Sorry for the basic silly question. But I really dont have any idea on solving this. I have ASP controls (One Text Box and One Drop Down List). Now I need to access value property of TextBox as well as SelectedIndex property of dropdown list. This should be as simple as:
for TextBox:

document.getElementById("<%= myControlID %>").value


用于下拉列表:


for DropDown List:

document.getElementById("<%= myControlID %>").selectedindex


但是在Visual Studio 2008中,当我编写这些代码时,它不起作用.我找不到相应控件的任何valueselectedindex属性.我不明白这一点,因为在大多数论坛和教程中,它们都是以我提到的简单方式提出的.

还有其他方法吗,或者我只是在这里想念什么?请帮帮我.在此先感谢


But in Visual Studio 2008, while I am writing these codes, it does not work. I can not find any value or selectedindex attribute for the respective control. I am not getting this, because in most forums and tutorials, they suggested in a simple way I mentioned.

Is there any other way or I am just missing something here? Please help me out. Thanks in advance

推荐答案

尝试一下,我认为我们使用的是单个Cote(即'''')或double(")
document.getElementById(''<%= myControlID%>'').value
try this i think we used single cote(ie '' '') either double (" ")
document.getElementById(''<%= myControlID %>'').value


这篇关于在访问ASP控件时遇到问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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