日期:2014-05-19  浏览次数:20470 次

???如何限制gridview的某一列只能输入数字????
???如何限制gridview的某一列只能输入数字????

------解决方案--------------------
<asp:GridView ID= "view1 " runat=server>
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:TextBox ID= "textbox1 " runat=server> </asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>

<asp:Button ID= "btn_submit " runat=server Text= "提交 " />

<script type= "text/javascript ">
function checkForm()
{
var obj=document.getElementById( "view1 ");
for(var i=1;i <obj.rows.length;i++)
{
if(isNaN(obj.rows[i].cells[0].getElementsByTagName( "INPUT ")[0].value))
{
alert( "请输入数字! ");
return false;
}
}
}
</script>