GridView JavaScript HtmlInputChecBox
来源:互联网 发布:sql select as where 编辑:程序博客网 时间:2024/05/30 23:16
JavaScript:
<script language="javascript">
var SelectCount=0;
function slcNo_click(sender,selectCount)
{
//alert(selectCount);
SelectCount=selectCount;
var count=0;
var chkother= document.getElementsByTagName("input");
for(i=0;i<chkother.length;i++)
{
if( chkother[i].type=='checkbox')
{
if(chkother[i].checked)
{
count++;
}
if(count>selectCount)
{
sender.checked=false;
alert("选择数不能大于3");
}
}
}
}
function Check()
{
//alert(SelectCount);
//return false;
var count=0;
var chkother= document.getElementsByTagName("input");
for(i=0;i<chkother.length;i++)
{
if( chkother[i].type=='checkbox')
{
if(chkother[i].checked)
{
count++;
}
}
}
if(count<SelectCount)
{
alert("入围数不够!");
return false;
}
else if(count==SelectCount)
{
return true;
}
}
</script>
.aspx:
<asp:GridView ID="GridView2" runat="server" DataSourceID="SqlDataSource2" AutoGenerateColumns="False" CellPadding="2" ForeColor="#333333" GridLines="None" Width="100%" OnRowDataBound="GridView2_RowDataBound" CellSpacing="1" AllowPaging="True" PageSize="15" OnPreRender="GridView2_PreRender">
<Columns>
<asp:TemplateField HeaderText="投票">
<ItemTemplate>
<input id="checkboxname" runat="server" name="checkboxname" type="checkbox" />
<asp:HiddenField ID="hidden_id" runat="server" Value='<%#Eval("BallotedMedicineID") %>' />
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</asp:TemplateField>
<asp:BoundField DataField="MedicineName" HeaderText="药品名" >
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</asp:BoundField>
<asp:BoundField DataField="CurrencyName" HeaderText="通用名" >
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="150px" />
</asp:BoundField>
<asp:BoundField DataField="DrugFormName" HeaderText="剂型" >
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</asp:BoundField>
<asp:BoundField DataField="StandardName" HeaderText="规格" >
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</asp:BoundField>
<asp:BoundField DataField="QualityLevelName" HeaderText="质量层次" >
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</asp:BoundField>
<asp:TemplateField HeaderText="厂家信息">
<ItemTemplate>
<asp:LinkButton ID="btn_viewEnterprise" runat="server"><%#Eval("EnterpriseName") %></asp:LinkButton>
<asp:HiddenField ID="hidden_eid" runat="server" Value='<%#Eval("EnterpriseID") %>'/>
</ItemTemplate>
<ControlStyle ForeColor="Navy" />
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#EFF3FB" Font-Size="9pt" Font-Names="宋体" ForeColor="Navy" />
<EditRowStyle BackColor="#2461BF" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" Font-Names="宋体" Font-Size="9pt" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" Font-Size="10pt" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
<script language="javascript">
var SelectCount=0;
function slcNo_click(sender,selectCount)
{
//alert(selectCount);
SelectCount=selectCount;
var count=0;
var chkother= document.getElementsByTagName("input");
for(i=0;i<chkother.length;i++)
{
if( chkother[i].type=='checkbox')
{
if(chkother[i].checked)
{
count++;
}
if(count>selectCount)
{
sender.checked=false;
alert("选择数不能大于3");
}
}
}
}
function Check()
{
//alert(SelectCount);
//return false;
var count=0;
var chkother= document.getElementsByTagName("input");
for(i=0;i<chkother.length;i++)
{
if( chkother[i].type=='checkbox')
{
if(chkother[i].checked)
{
count++;
}
}
}
if(count<SelectCount)
{
alert("入围数不够!");
return false;
}
else if(count==SelectCount)
{
return true;
}
}
</script>
.aspx:
<asp:GridView ID="GridView2" runat="server" DataSourceID="SqlDataSource2" AutoGenerateColumns="False" CellPadding="2" ForeColor="#333333" GridLines="None" Width="100%" OnRowDataBound="GridView2_RowDataBound" CellSpacing="1" AllowPaging="True" PageSize="15" OnPreRender="GridView2_PreRender">
<Columns>
<asp:TemplateField HeaderText="投票">
<ItemTemplate>
<input id="checkboxname" runat="server" name="checkboxname" type="checkbox" />
<asp:HiddenField ID="hidden_id" runat="server" Value='<%#Eval("BallotedMedicineID") %>' />
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</asp:TemplateField>
<asp:BoundField DataField="MedicineName" HeaderText="药品名" >
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</asp:BoundField>
<asp:BoundField DataField="CurrencyName" HeaderText="通用名" >
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="150px" />
</asp:BoundField>
<asp:BoundField DataField="DrugFormName" HeaderText="剂型" >
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</asp:BoundField>
<asp:BoundField DataField="StandardName" HeaderText="规格" >
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</asp:BoundField>
<asp:BoundField DataField="QualityLevelName" HeaderText="质量层次" >
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</asp:BoundField>
<asp:TemplateField HeaderText="厂家信息">
<ItemTemplate>
<asp:LinkButton ID="btn_viewEnterprise" runat="server"><%#Eval("EnterpriseName") %></asp:LinkButton>
<asp:HiddenField ID="hidden_eid" runat="server" Value='<%#Eval("EnterpriseID") %>'/>
</ItemTemplate>
<ControlStyle ForeColor="Navy" />
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#EFF3FB" Font-Size="9pt" Font-Names="宋体" ForeColor="Navy" />
<EditRowStyle BackColor="#2461BF" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" Font-Names="宋体" Font-Size="9pt" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" Font-Size="10pt" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
- GridView JavaScript HtmlInputChecBox
- 【JavaScript】GridView
- Javascript實現GridView
- javascript遍历gridview 控件
- gridview中添加checkbox(javascript)
- 利用JavaScript选择GridView行
- 利用JavaScript选择GridView行
- javascript操作 gridview的单元格
- 利用JavaScript选择GridView行
- 用javascript实现gridview的固定表头
- 用javascript操纵GridView中CheckBox
- Check/Uncheck checkboxes in GridView using JavaScript
- gridview中复选框全选的javascript
- gridview 中的选项javascript选择方法
- JavaScript获取GridView选择的行内容
- 使用JavaScript在客户端验证GridView控件
- GridView固定表头(不用javascript只用CSS)
- GridView固定表头(不用javascript只用CSS)?
- 求两个表的差集
- 成长的寓言-转载
- 工作中的颈椎操
- Perl简介
- 栈的应用
- GridView JavaScript HtmlInputChecBox
- jsp内置对象
- 正则表达式30分钟入门教程
- 循环链表实验
- Toad下载(外加两个Knowledge.Xpert)(带注册机)
- 经过十多个小时的飞行,终于抵达AMSTERDAM
- 手机的摄像头启动了抓不到图象?
- 关于客户端和服务端通信方式的一些实验
- 队列