我如何在GridView中进行超链接的价值



我有GridView,我可以访问单元格的值,而不是超链接一个。当我尝试获得它时,我只会得到空字符串。第五单元是超链接单元。

    protected void GridView4_RowDeleting(object sender, GridViewDeleteEventArgs e)
        TableCell cell = GridView4.Rows[e.RowIndex].Cells[1];
        string sid = cell.Text;
        string id = Session["id"].ToString();
        TableCell cell2 = GridView4.Rows[e.RowIndex].Cells[2];
        string sid2 = cell2.Text;          

            TableCell cell3 = GridView4.Rows[e.RowIndex].Cells[5];
        string sid3 = cell3.Text;

这是我的超级链接:

<asp:HyperLinkField DataNavigateUrlFields="DosyaAdresi" DataNavigateUrlFormatString="dosyalar{0}" DataTextField="DosyaAdresi" HeaderText="DosyaAdresi" DataTextFormatString="DosyaAdresi" Text="DosyaAdresi" >

我期望sid3喜欢" 1531351.jpg",但返回"。

您的表单元格没有任何文本,而是具有超链接控件,您应该检索它然后获得文本。

字符串sid3 =(((超链接(gridview4.rows [e.rowindex] .cells [5] .controls [0](。文本;

最新更新