我正在尝试在复选框的CheckChange
事件中获取标签的文本。我的复选框更改事件处理程序是:
protected void chk_selector_CheckedChanged(object sender, EventArgs e)
{
}
我的标签是:
<asp:TemplateField HeaderText="Title">
<ItemTemplate>
<a href="javascript:openPopup('Ds_ProjectDetails.aspx?mode=1&cid=<%# Eval("CompanyID") %>&prj=<%#Eval("ProjectID")%>' )">
<%--<%#Eval("Title")%>--%>
<asp:Label ID="lblTitle" runat="server" Text='<%# Bind("Title") %>'></asp:Label></a>
</ItemTemplate>
<ControlStyle Width="400px" />
</asp:TemplateField>
CheckChange
调用复选框事件时,我得到了 ID :
CheckBox chk = (CheckBox)sender;
GridViewRow gr = (GridViewRow)chk.Parent.Parent;
bool flag = chk.Checked;
string EntryID = Convert.ToString(gvProjects.DataKeys[gr.RowIndex].Value);
con.Update_inv_Proj_Flag(EntryID, flag);