cs : ArrayList alist = new ArrayList();
System.Web.UI.WebControls.CheckBox box;
for (int i = 0; i < DataGrid1.Items.Count; i++)
{
box = ((CheckBox)this.DataGrid1.Items[i].Cells[4].Controls[1]);
if (box.Checked)
{
Response.Write(box.Text);
}
}
aspx:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="invete_retify2.aspx.cs" Inherits="admin_cus_manage_invete_retify2" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>yy3721后台管理</title>
<link href="../style/sys_edit_admin.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript"> function selectChk(flag)
{
var element;
var i;
element = document.all;
if(flag)
{
for(i = 0;i < element.length;i ++)
{
if(element[i].tagName == "INPUT" && element[i].type == "checkbox")
{
element[i].checked = true;
}
}
}
else
{
for(i = 0;i < element.length;i ++)
{
if(element[i].tagName == "INPUT" && element[i].type == "checkbox")
{
element[i].checked = false;
}
}
}
}
</script>
</head>
<body>
<form id="form1" runat="server" action="invete_retify2.aspx">
<table align="center" border="1" cellpadding="0" cellspacing="0" width="703">
<tr>
<td colspan="2" style="height: 50px">
招商信息认证</td>
</tr>
<tr>
<td align="center" class="add_manage_text" style="width: 256px; height: 35px">
搜索类型:<asp:DropDownList ID="DropDownList1" runat="server" Width="105px">
<asp:ListItem Value="[User_name]">会员名称</asp:ListItem>
<asp:ListItem Value="Business_name">产品名称</asp:ListItem>
<asp:ListItem Value="Business_company">公司名称</asp:ListItem>
</asp:DropDownList></td>
<td style="height: 35px; width: 339px;">
关键字:<asp:TextBox ID="TextBox1" runat="server" Width="105px"></asp:TextBox>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click1" Text="搜 索" /></td>
</tr>
<tr>
<td colspan="2" rowspan="2" style="height: 344px" valign="top">
<p align="center">
<asp:DataGrid ID="DataGrid1" runat="server" AllowPaging="True" AlternatingItemStyle-BackColor="#eeeeee"
AutoGenerateColumns="False" BorderColor="Black" BorderWidth="1px" CellPadding="3"
Font-Name="Verdana" Font-Names="Verdana" Font-Size="8pt" HeaderStyle-BackColor="#aaaadd"
HorizontalAlign="Justify" PagerStyle-HorizontalAlign="Right"
PagerStyle-Mode="NumericPages" OnPageIndexChanged="DataGrid1_PageIndexChanged" Height="30px" Width="100%">
<Columns>
<asp:BoundColumn DataField="business_name" HeaderText="产品"></asp:BoundColumn>
<asp:BoundColumn DataField="user_name" HeaderText="会员"></asp:BoundColumn>
<asp:BoundColumn DataField="business_company" HeaderText="公司名称"></asp:BoundColumn>
<asp:BoundColumn DataField="business_issuance" DataFormatString="{0:yyyy-MM-dd hh:mm:ss}" HeaderText="发布时间"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="选择">
<ItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"business_id") %>'/>
</ItemTemplate>
<HeaderTemplate>
选择
</HeaderTemplate>
</asp:TemplateColumn>
</Columns>
<PagerStyle HorizontalAlign="Right" Mode="NumericPages" />
<AlternatingItemStyle BackColor="#EEEEEE" />
<HeaderStyle BackColor="#AAAADD" />
</asp:DataGrid>
<asp:LinkButton ID="LinkButton1" Font-Name="verdana" Font-size="8pt" OnClick="LinkButton1_Click" runat="server">LinkButton</asp:LinkButton>
<asp:LinkButton ID="LinkButton2" Font-Name="verdana" Font-size="8pt" OnClick="LinkButton2_Click" runat="server">LinkButton</asp:LinkButton>
<asp:LinkButton ID="LinkButton3" Font-Name="verdana" Font-size="8pt" OnClick="LinkButton3_Click" runat="server">LinkButton</asp:LinkButton>
<asp:LinkButton ID="LinkButton4" Font-Name="verdana" Font-size="8pt" OnClick="LinkButton4_Click" runat="server">LinkButton</asp:LinkButton>
<asp:Label ID="Label1" Font-Name="verdana" Font-size="8pt" runat="server" Text="Label"></asp:Label>
<asp:Label ID="Label2" Font-Name="verdana" Font-size="8pt" runat="server" Text="Label"></asp:Label></p>
</td>
</tr>
<tr>
</tr>
<tr>
<td align="center" colspan="2" style="height: 35px">
<asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="认 证" />
<input id="Button3" type="button" value="全 选" language="javascript" onclick="selectChk(true)" />
<input id="Button4" type="button" value="取 消" language="javascript" onclick="selectChk(false)" />
</td>
</tr>
</table>
</form>
</body>
</html>
System.Web.UI.WebControls.CheckBox box;
for (int i = 0; i < DataGrid1.Items.Count; i++)
{
box = ((CheckBox)this.DataGrid1.Items[i].Cells[4].Controls[1]);
if (box.Checked)
{
Response.Write(box.Text);
}
}
aspx:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="invete_retify2.aspx.cs" Inherits="admin_cus_manage_invete_retify2" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>yy3721后台管理</title>
<link href="../style/sys_edit_admin.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript"> function selectChk(flag)
{
var element;
var i;
element = document.all;
if(flag)
{
for(i = 0;i < element.length;i ++)
{
if(element[i].tagName == "INPUT" && element[i].type == "checkbox")
{
element[i].checked = true;
}
}
}
else
{
for(i = 0;i < element.length;i ++)
{
if(element[i].tagName == "INPUT" && element[i].type == "checkbox")
{
element[i].checked = false;
}
}
}
}
</script>
</head>
<body>
<form id="form1" runat="server" action="invete_retify2.aspx">
<table align="center" border="1" cellpadding="0" cellspacing="0" width="703">
<tr>
<td colspan="2" style="height: 50px">
招商信息认证</td>
</tr>
<tr>
<td align="center" class="add_manage_text" style="width: 256px; height: 35px">
搜索类型:<asp:DropDownList ID="DropDownList1" runat="server" Width="105px">
<asp:ListItem Value="[User_name]">会员名称</asp:ListItem>
<asp:ListItem Value="Business_name">产品名称</asp:ListItem>
<asp:ListItem Value="Business_company">公司名称</asp:ListItem>
</asp:DropDownList></td>
<td style="height: 35px; width: 339px;">
关键字:<asp:TextBox ID="TextBox1" runat="server" Width="105px"></asp:TextBox>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click1" Text="搜 索" /></td>
</tr>
<tr>
<td colspan="2" rowspan="2" style="height: 344px" valign="top">
<p align="center">
<asp:DataGrid ID="DataGrid1" runat="server" AllowPaging="True" AlternatingItemStyle-BackColor="#eeeeee"
AutoGenerateColumns="False" BorderColor="Black" BorderWidth="1px" CellPadding="3"
Font-Name="Verdana" Font-Names="Verdana" Font-Size="8pt" HeaderStyle-BackColor="#aaaadd"
HorizontalAlign="Justify" PagerStyle-HorizontalAlign="Right"
PagerStyle-Mode="NumericPages" OnPageIndexChanged="DataGrid1_PageIndexChanged" Height="30px" Width="100%">
<Columns>
<asp:BoundColumn DataField="business_name" HeaderText="产品"></asp:BoundColumn>
<asp:BoundColumn DataField="user_name" HeaderText="会员"></asp:BoundColumn>
<asp:BoundColumn DataField="business_company" HeaderText="公司名称"></asp:BoundColumn>
<asp:BoundColumn DataField="business_issuance" DataFormatString="{0:yyyy-MM-dd hh:mm:ss}" HeaderText="发布时间"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="选择">
<ItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"business_id") %>'/>
</ItemTemplate>
<HeaderTemplate>
选择
</HeaderTemplate>
</asp:TemplateColumn>
</Columns>
<PagerStyle HorizontalAlign="Right" Mode="NumericPages" />
<AlternatingItemStyle BackColor="#EEEEEE" />
<HeaderStyle BackColor="#AAAADD" />
</asp:DataGrid>
<asp:LinkButton ID="LinkButton1" Font-Name="verdana" Font-size="8pt" OnClick="LinkButton1_Click" runat="server">LinkButton</asp:LinkButton>
<asp:LinkButton ID="LinkButton2" Font-Name="verdana" Font-size="8pt" OnClick="LinkButton2_Click" runat="server">LinkButton</asp:LinkButton>
<asp:LinkButton ID="LinkButton3" Font-Name="verdana" Font-size="8pt" OnClick="LinkButton3_Click" runat="server">LinkButton</asp:LinkButton>
<asp:LinkButton ID="LinkButton4" Font-Name="verdana" Font-size="8pt" OnClick="LinkButton4_Click" runat="server">LinkButton</asp:LinkButton>
<asp:Label ID="Label1" Font-Name="verdana" Font-size="8pt" runat="server" Text="Label"></asp:Label>
<asp:Label ID="Label2" Font-Name="verdana" Font-size="8pt" runat="server" Text="Label"></asp:Label></p>
</td>
</tr>
<tr>
</tr>
<tr>
<td align="center" colspan="2" style="height: 35px">
<asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="认 证" />
<input id="Button3" type="button" value="全 选" language="javascript" onclick="selectChk(true)" />
<input id="Button4" type="button" value="取 消" language="javascript" onclick="selectChk(false)" />
</td>
</tr>
</table>
</form>
</body>
</html>
解决方案 »
- 如何获得gridview中hyper控件的值
- GetProperty("")为什么取到的值总是null
- 求图片地址正则C#,越详细分越多。
- 求:asp.net 实现类似管家婆的采购单那样效果,和原理
- 用CommandName或CommandArgument保存uniqueidentifier或datetime数据类型时,如何在代码中应用到SQL语句
- 求:一个很有挑战的sql语句写法!!!
- 急!异常现象:点保存后显示“<input type="hidden" name="__VIEWSTATE" value="dDw5Nzk4ODk2Mzg7dDxwPGw8Y3VyUGFnZUluZGV4O1BhZ2VDb3Vud
- 发送简单电子邮件的问题!
- 类型“DropDownList”的控件“DropDownList1”必须放在具有 runat=server 的窗体标记内。 这个错误怎么解决阿~!~!~!我快急死了
- 请大家给点参考,网页在验证用户登陆之后,把原来内容清除掉,显示新的内容.
- 指定了[AjaxMethod]属性的方法是不是不能处理服务器端属性
- 请问在asp.net 中如何调用老dll
<asp:CheckBox ID="CheckBox1" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"business_id") %>'/>
</ItemTemplate>
----------
从这里来看应该是((CheckBox)this.DataGrid1.Items[i].Cells[4].Controls[0])
{
box = ((CheckBox)this.DataGrid1.Items[i].Cells[4].findcontrol("CheckBox1"));
if (box.Checked)
{
Response.Write(box.Text);
}
}
这个也不行。。~ 我估计不是这儿的错。。好想是aspx 里面的事