关于datagrid中获取超级连接列的值 string link = ((HyperLink)(e.item.cells[i].findControl("HyperLink1")).Text 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 agree with xiaohutushen(xiaohutushen) 可是在DATAGRID中利用超级联接列并没有编号,那么我在findControl("HyperLink1"))的HyperLink1应该写什么呢????? DATAGRID中利用超级联接列的话没有ID,有的话在那里能找到ID呢,谢谢!!! 对不起,刚开始看错了,给错答案了,用下面的方法就可以了((HyperLink)(e.Item.Cells[0].Controls[0])).Text 如果我是用数据库里取出来的值的超连接呢》?<a href=''></a>这样也可以吗?是不是也是HyperLink类型? To china2001ok(黑饿黑) 对你所说的,好像不行噢,呵呵,还没想到办法 借个地方: <asp:datagrid autogeneratecolumns="false" CellPadding="0" id="DataGrid_Query" ShowFooter="true" ShowHeader="true" align="center" runat="server" width = "1800px" BorderWidth="1px" > <columns> <asp:boundcolumn headertext="修改" /> <asp:boundcolumn headertext="工作号" datafield="fworkNo" /> </columns></asp:datagrid>Sub Tri_Query(sender As Object, e As EventArgs) '对DataGrid修改值 For i = 0 To DataGrid_Query.Items.Count - 1 ls_text = DataGrid_Query.Items(i).Cells(19).Text select case ls_text case "0" DataGrid_Query.Items(i).Cells(19).Text = "被取消" case "1" DataGrid_Query.Items(i).Cells(19).Text = "未派车" DataGrid_Query.Items(i).Cells(0).Text= "修改" DataGrid_Query.Items(i).Cells(0).ForeColor = System.Drawing.Color.blue 'response.redirect("consignUpdate.aspx") ????我要在这里加一个超级联接,指向另外一个页面,打开这个页面来修改数据,请问如何写???????? end select NextEnd Sub TO:jkx100() 只要你传递过去你的主健值就可以了传递方式,可以用session,querystring,viewstate等获得主建后,再向数据库读取,显示出来就可了 可以这样得到ID:string Id=DataGrid1.DataKeys[(int)item.ItemIndex].ToString(); <asp:HyperLinkColumn Text="更新图片" Target="_self" DataNavigateUrlField="新闻编号" DataNavigateUrlFormatString="add_images.aspx?id={0}" DataTextField="新闻编号" HeaderText="更新图片" DataTextFormatString="更新图片"> <ItemStyle HorizontalAlign="Center" ForeColor="#0033FF" VerticalAlign="Middle"></ItemStyle> 如果是linkbutton的话,下面这个可以,我昨天才找到的ctype(datagrid1.selecteditem.cells(3).controls(0),linkbutton).text你试试把linkbutton换成hyperlinkcolumn iis 出错 字符转成北京时间怎么转 replace替换的问题 求一正则表达式 有人用过Asp.Net版的CuteEditor在线编辑器吗?发现一个问题 求大哥们帮忙解决一个在ASP.NET中操作Word的问题 新人请教!大家来帮我看看这段代码为什么不执行? 求助!db.SubmitChanges();指定的转换无效 使用母版后各页面title设定问题 ?.NET里新建站点怎么做,好象他只能建虚拟目录。 这到底是什么错误 上传文件问题,很急,在线等
用下面的方法就可以了
((HyperLink)(e.Item.Cells[0].Controls[0])).Text
是不是也是HyperLink类型?
<asp:datagrid autogeneratecolumns="false" CellPadding="0" id="DataGrid_Query" ShowFooter="true" ShowHeader="true" align="center" runat="server" width = "1800px" BorderWidth="1px" >
<columns>
<asp:boundcolumn headertext="修改" />
<asp:boundcolumn headertext="工作号" datafield="fworkNo" />
</columns>
</asp:datagrid>Sub Tri_Query(sender As Object, e As EventArgs)
'对DataGrid修改值
For i = 0 To DataGrid_Query.Items.Count - 1
ls_text = DataGrid_Query.Items(i).Cells(19).Text
select case ls_text
case "0"
DataGrid_Query.Items(i).Cells(19).Text = "被取消"
case "1"
DataGrid_Query.Items(i).Cells(19).Text = "未派车"
DataGrid_Query.Items(i).Cells(0).Text= "修改"
DataGrid_Query.Items(i).Cells(0).ForeColor = System.Drawing.Color.blue
'response.redirect("consignUpdate.aspx") ????我要在这里加一个超级联接,指向另外一个页面,打开这个页面来修改数据,请问如何写????????
end select
Next
End Sub
只要你传递过去你的主健值就可以了
传递方式,可以用session,querystring,viewstate等
获得主建后,再向数据库读取,显示出来就可了
string Id=DataGrid1.DataKeys[(int)item.ItemIndex].ToString();
<ItemStyle HorizontalAlign="Center" ForeColor="#0033FF" VerticalAlign="Middle"></ItemStyle>
ctype(datagrid1.selecteditem.cells(3).controls(0),linkbutton).text
你试试把linkbutton换成hyperlinkcolumn