<%-- <script type="text/javascript">
//分类排序的脚本
function CPSort()
{
var sortId = document.getElementById("<% =GridView1.ClientID %>").getElementsByTagName("CP_SortID");
for(int i=0;i < sortId.legth;i ++)
{
alert(sortId[i].value);
}
}
</script>--%>
这样能获取到值么 ,不行的话 指教下 ,:-) 有测试过的Js 就更好啦
<asp:GridView ID="GridView1" ...>
<span><%# Eval("ID") %></span>
<span><%# Eval("Name") %></span>
<asp:TextBox ID="" Text='<%# Eval("SortId") %>' ... />
<asp:GridView>
... 为其些属性 而已
JQuery 不怎么熟悉 ,还请点到 详处 说下吧
用document.getElementByName("");
应该可以搞了。
for(var i=0;i<con.length;i++){
alert(con.value);
}
var sortId = document.getElementById("<% =GridView1.ClientID %>").getElementsByTagName("input");
for(int i=0;i < sortId.legth;i ++)
{
alert(sortId[i].value);
}
看了下 最终还是以Table Tr Td 的形式展示出来的
<%-- <script type="text/javascript">
//分类排序的脚本
function CPSort()
{
//var sortId = document.getElementById("<% =GridView2.ClientID %>").getElementsByTagName("CP_SortID");
var srorId = $("# <% =GridView2.ClientID %>:text");
for(int i=0;i < sortId.legth;i ++)
{
alert(srorId.value);
}
}
</script>--%>测试了下 ,有错误 : 对象不能为空 !#4 只能获取单个控件的值吧 多个也可以吗? ID=是相同的
#5 你的可以用 ,借用下 就不可以(alert)啦 :-)
#7 是指用<input type="text" id="SortId" />吧 也可以.
TagName 这里边就是input
然后你可以判断是不是文本框var i
function SelectCheckBox()
{
var GridView1 = document.getElementById("<%=GridView1.ClientID %>");
for(i=1;i<GridView1.rows.length; i++)
{
var bool=GridView1.rows[i].cells[0].getElementsByTagName("INPUT")[2];
alert(bool.value);
}
}