本文介绍了查找超链接列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我有一个带有列的Datagrid: < asp:HyperLinkColumn DataTextField =" JobTitle" DataNavigateUrlField =" PositionID" DataNavigateUrlFormatString =" AddNewPositions.aspx? PositionID = {0}" HeaderText ="职位名称" 可见=" True" SortExpression =" JobTitle" /> 我可以通过执行以下操作找到我感兴趣的行: 对于DataGrid1中的每个oGridItem作为DataGridItem。项目 pidLabel = CType(oGridItem.FindControl(" PositionID"),Label) 如果pidLabel.Text = 54则 做点什么 结束如果 next 但是我想让这个专栏的文本变成另一种颜色。问题 是我无法找到它。没有这个ID,所以我不能做一个 的findControl来获得它。 有没有办法找到控件并改变它颜色? 如果我能找到它,我会做类似的事情: Answer.ForeColor = System.Drawing.Color.Yellow 谢谢, Tom 解决方案 I have a Datagrid with a column:<asp:HyperLinkColumnDataTextField="JobTitle"DataNavigateUrlField="PositionID"DataNavigateUrlFormatString="AddNewPositions.aspx? PositionID={0}"HeaderText="Job Title"Visible="True"SortExpression="JobTitle"/>I can find the row that I am interested in by doing the following:For each oGridItem as DataGridItem in DataGrid1.itemspidLabel = CType(oGridItem.FindControl("PositionID"),Label)if pidLabel.Text = 54 thenDo somethingend ifnextBut I want to make this text for this column a different color. The problemis that I have no way to find it. There is no ID for this so I can''t do afindControl to get it.Is there a way to find the control and change the color?If I could find it I would do something like:Answer.ForeColor = System.Drawing.Color.YellowThanks,Tom 解决方案 这篇关于查找超链接列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-31 08:15