0

I have a gridview bound with a database. I would like to add an extra column which has a linkbutton. The intention is that when clicked on the linkbutton, the user could toggle the value of a column which is bounded with the database.

I don't have any good ideas how to get started on this. Any help would be greatly appreciated!

Regards, Thijs

4

2 に答える 2

0

私がこれに取り組む方法は、GridRecordまたはグリッド行を表す何かと呼ばれるクラスを宣言することです。

class GridRecord
{
}

次に、クラスで、リンク列を含むグリッドの列となるすべてのプロパティを定義します。

class GridRecord
{
    private Image m_Link = [some image];
    public GridRecord(){}

    public Image Link
    {
        get { return m_Link; }
    }
}

次に、グリッドコードで:

IList<GridRecord> records = new List<GridRecords>();
//Fill records object as you like.
Grid1.DataSource = records;

次に、RowCellClickまたは同様のイベントを処理し、クリックされたセルがプロパティタイプLinkであるかどうかを確認し、それを使用します。

于 2011-12-01T14:37:59.037 に答える