簡體   English   中英

刪除Datagridview中的鏈接文本

[英]Remove link text in Datagridview

我有一個從列表填充的DataGridView 然后,我在最后一column中定義了一個鏈接column ,該column不是DataBound所說的View ,如果滿足條件,如何刪除此鏈接文本。 我有以下內容:

        dgvReport.AutoGenerateColumns = false;
        dgvReport.DataSource = queries;

        //locals 
        Int32 lastColumnIndex = this.dgvReport.Columns.Count - 1;

        //hide reads links for the null queries
        for (int i=0; i < queries.Count; i++) {
            if (queries[i].SomeID == null || queries[i].AnotherID == null) {
                this.dgvReport.Rows[i].Cells[lastColumnIndex].Value = "";
            }
        }

這不起作用,我的列文本仍然顯示View 有任何想法嗎?

編輯 :lastColumnIndex是24的確是最后一列索引

你可以試試

View.PlainTextBehaviour = true;

它將刪除鏈接並將其顯示為純文本

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM