【发布时间】:2019-05-03 13:53:57
【问题描述】:
我有 gridview ,我可以访问单元格的值,但不能访问超链接。 当我尝试获取它时,我只得到空字符串。第 5 个单元格是超链接单元格。
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”但返回“”。
【问题讨论】:
-
stackoverflow.com/a/18189418/10466324 我希望你能做剩下的人:)
-
嗨,当我尝试它时,我得到了文本名称“Dosyaadi”。不是 Dosyaadi 的价值。你能帮忙吗? @Tay
-
你的意思是 NavigateUrl ?继续使用这个属性:)
-
我想我正在尝试获取 DataTextField 或 NavigateUrl :) 我只是不想向用户显示地址但想使用价值
-
然后使用 DataTextField :)