このGridview
の列10 templatefield
:それはforeach
ループ内で参照されるのはここGridview TemplateFieldの行を参照するには?
<asp:TemplateField>
<HeaderTemplate>
<asp:Label runat="server">Active Licenses</asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="lblActiveCodes" runat="server" Text='intValues'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
です。
foreach (GridViewRow row in gvCustomers.Rows)
{
if (row.Cells[10].Text.Equals(0))
{
row.Visible = false;
}
}
だから、GridView
の列10であり、私は目に見えない値0を用いて細胞を作るために探しています。 intValues
はint
です。これはデータベースのものです。 gvCustomers
は、私のGridView
のID
です。
どうすればrow.Cells[10]
が機能しませんが、もっと重要なことは、どのように動作させることができますか?
このように 'Visible = 'プロパティを設定することができます。'%#GetVisible(Eval( "intValues").ToString())%>' 'そして、コードビハインドの' GetVisible'メソッドでゼロに等しい場合はfalseを返します。私が7時間前に答えたこの質問をチェックしてください:http://stackoverflow.com/questions/40263845/set-date-visible-condition-in-linkbutton –