我在webform上有一个网格视图,其中有一个包含id的隐藏字段,如何从id字段中捕获数据以在我的update语句中使用?这是我的语法看起来像...
的 HTML
def replace(self, pos, note):
"""
Replace the score of the participant at the given position with a new score
Input: pos, note - integer
Output: the old score was replaced
"""
scores = self.repo.getAll()
scores[pos] = note
return scores
C#
def getAll(self):
return self._participantList[:].
答案 0 :(得分:3)
HTML:
<asp:BoundField DataField="weekofyear" HeaderText="Week" />
<asp:BoundField DataField="supportname" HeaderText="Name" />
<%--<asp:BoundField DataField="supid" HeaderText="SupportIDName" Visible="false"/>--%>
<asp:TemplateField>
<ItemTemplate>
<asp:Label runat="server" Text='<%#Eval("supid") %>' ID="supid" Visible="false"></asp:Label>
</ItemTemplate>
<ItemTemplate>
<asp:CheckBox ID="TicketCompleted" runat="server" AutoPostBack="true" OnCheckedChanged="TicketCompletedCompleted_Click" Checked='<%# Convert.ToBoolean(Eval("TicketCompleted")) %>' />
</ItemTemplate>
</asp:TemplateField>
C#
CheckBox chk = (CheckBox)row.FindControl("TicketCompleted");
if (chk.Checked)
{
string ID = ((Label)row.FindControl("supid")).Text;
}