62,074
社区成员
发帖
与我相关
我的任务
分享
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("ab") %>' ForeColor='<%# Eval("cd").ToString().EndsWith("R")?System.Drawing.Color.Red:System.Drawing.Color.Black %>'>
</asp:Label>
<asp:DropDownList runat="server" ID="myList" DataSource='<%# this.GetRandomString((string)Eval("yf")) %>' />
</ItemTemplate>
chk.FindControl("Label1") as Label;
chk.FindControl("myList") as DropdownList;
<ItemTemplate>
<asp:CheckBox ID="chk" runat="server" 我绑定啦='<%# Eval("yf") %>' 我绑定呀='<%# ((GridViewRow)Container).RowIndex %>' OnCheckedChanged="chk_CheckedChanged" />
</ItemTemplate>
protected void chk_CheckedChanged(object sender, EventArgs e)
{
CheckBox chk = (CheckBox)sender;
string a = chk.Attributes["我绑定啦"];
string b = chk.Attributes["我绑定呀"];
//...............
}
protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
{ int i = ((GridViewRow)((CheckBox)sender).NamingContainer).RowIndex;}