0

サーバー側のテーブルセルにリンクボタンコントロールを追加したいと思います。セルにはテキストも含まれており、追加するとコントロールによって上書きされます。コントロールをセルに追加し、テキストも残しておくにはどうすればよいですか?

        //Create a table cell and add text to it
        TableCell commentCell = new TableCell();
        commentCell.Text = "Text to remain in the cell."

        //Create a linkbtn and add it to the table cell
        LinkButton lbtnComments = new LinkButton();
        lbtnComments.Text = "...";
        lbtnComments.Style["float"] = "right";
        commentCell.Controls.Add(lbtnComments);
4

2 に答える 2

2

Label私はあなたの前に単に追加しますLinkButton

TableCell commentCell = new TableCell();
Label lblComment = new Label();
lblComment.Text = "Text to remain in the cell."
commentCell.Controls.Add(lblComment);
LinkButton lbtnComments = new LinkButton();
commentCell.Controls.Add(lbtnComments);
于 2012-07-27T18:27:00.227 に答える
0

テキストを LiteralControl に追加します。

    //Create a table cell and add text to it
    TableCell commentCell = new TableCell();
    commentCell.Controls.Add(new LiteralControl("Text to remain in the cell.");

    //Create a linkbtn and add it to the table cell
    LinkButton lbtnComments = new LinkButton();
    lbtnComments.Text = "...";
    lbtnComments.Style["float"] = "right";
    commentCell.Controls.Add(lbtnComments);
于 2014-03-20T14:30:22.097 に答える