私はそのRepeater Control
中にさまざまなボタンを持っています。
ボタンがクリックされると、それ自体を無効にして、再度クリックできないようにする必要があります。働く。
ただし、そのボタンをクリックすると、それ以外のボタンを有効にする必要があります。
そのため、クリックすると無効にする必要があります。別のボタンをクリックすると、前のボタンが有効になり、そのボタンが無効になる必要があります。
だから私は試しました:
Button btnLoad = (Button)e.Item.FindControl("btnLoad");
foreach (Button b in e.Item.Controls.OfType<Button>().Select(c => c).Where(b => b != btnLoad))
{
b.Enabled = true;
}
btnLoad.Text = "Currently Viewing";
btnLoad.Enabled = false;
しかし、それは機能していません。配置する場所に応じて、すべてのボタンを有効のままにする (ただし、テキストを変更する) か、何もしないかのいずれかです。
これを機能させるにはどうすればよいですか?
編集:コードはここにあります:
protected void rptPdfList_ItemCommand(object source, RepeaterCommandEventArgs e)
それが私が使用する理由ですButton btnLoad = (Button)e.Item.FindControl("btnLoad");
。
メソッドは次の場所にあります。
switch (e.CommandName)
{
case "LoadDoc":
//Above code
break;
}