我想将我的 totalcomplete 变量绑定到我的 gridProgress 中的 lblComplete 但我不知道该怎么做,有人可以帮我吗?
ASP 代码:
<asp:GridView ID="gridProgress" runat="server" AutoGenerateColumns="False">
<Columns>
<asp:TemplateField HeaderText="Complete">
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="10%" />
<HeaderStyle HorizontalAlign="Center" />
<ItemTemplate>
<asp:Label ID="lblComplete" runat="server"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
C#代码:
da = new SqlDataAdapter(sql, oConn);
da.Fill(ds);
//count number of tasks completed, not completed
int count = ds.Tables[0].Rows.Count;
string value = ds.Tables[0].Rows[0]["Completed"].ToString();
int completed = 0;
for (int i = 0; i < count; i++)
{
if (value == "No")
{
completed++;
}
int totalcomplete = completed;
//here i want to bind totalcomplete to my lblCompleted
}