私は、ファイルとして表示された表示状態をテキストとして持ち、コマンドイベントをトリガーするデータグリッドを持っていますので、asp:ButtonFieldのようにサーバー側で処理できます。DataGridテキストフィールドGridView1_RowCommandイベントをトリガーする
私の失敗のコードは次のとおりです。
<asp:ButtonField CommandName="CallHist"
ButtonType="Button" Text ="<%#GetJobs(Eval("currStatus"))%>" >
</asp:ButtonField>
私はエラーを取得する:
Literal content ('" >') is not allowed within a 'System.Web.UI.WebControls.ButtonField'.
私は既存のworkign ButtonFieldsを変更しようとしています:
<asp:ButtonField CommandName="editRecord" ControlStyle-Height="16px" ControlStyle-Width ="16px" ButtonType="image" ImageUrl="images/edit-icon.png">
</asp:ButtonField>
<asp:ButtonField CommandName="deleteRecord" ControlStyle-Height="16px" ControlStyle-Width ="16px" ButtonType="Image" ImageUrl="images/close-icon.png">
</asp:ButtonField>
ノーでも試してみました運を使って、<asp:TemplateField>
データを表示してクリック可能なイベントを表示するフィールドを取得するにはどうすればよいですか?
私はこれが(ID別名dataKeyを渡すために取得する方法私はこのような何かを行うことができますので、私はこのような行を行うことができます:protected void GridView1_RowCommand(Object sender、GridViewCommandEventArgs e) { int index = Convert.ToInt32(e.CommandArgument); if(e.CommandName.Equals( "detail")) – kacalapy
IDフィールドに 'CommandArgument'をバインドできます。私はそれを示すために私の答えを更新しました。実際のIDフィールド名に合わせてコードを調整することができます。 – ConnorsFan