本文介绍了如何在gridview中放置的gridview中为整行设置超链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 亲爱的朋友们, 我使用的是GridView。我需要为整行设置一个超链接,我已经开发了那个。但每当点击SName时,我得到了下一页其余的列我没有链接。我使用了以下代码。Dear Friends,I have working with GridView. I need to set a hyperlink for entire row, i have develop that one. But whenever click on SName only I got the next page rest of the columns I don't have link. The following code I have used.<asp:GridView ID="GridView1" runat="server"><asp:TemplateField HeaderText="SName"<ItemTemplate><a href='<%#"StuDetails.aspx?Id="+DataBinder.Eval(Container.DataItem,"Id") %>' target="_blank"><%#Eval("SName")%></a></ItemTemplate></TemplateFiled><asp:BoundField DataField="SName" HeaderText="Student Name" /><asp:BoundField DataField="SMarks" HeaderText="Student Marks" /><asp:BoundField DataField="SDOB" HeaderText="Student DOB" /> b $ bprotected void GridView1_RowCreated1(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes.Add("onmouseover", "this.className='mouseover'"); e.Row.Attributes.Add("onmouseout", "this.className='mouseout'"); e.Row.Attributes["onclick"] = this.Page.ClientScript.GetPostBackClientHyperlink(this.GridView1, "Select$" + e.Row.RowIndex); } } 如何使用〜/ StuDetails.aspx?Id =+ DataBinder.Eval(Container.DataItem, Id)target =_ blank到位选择$ 提前致谢。How to use "~/StuDetails.aspx?Id="+DataBinder.Eval(Container.DataItem,"Id") target="_blank" in place "Select$"Thanks in advance.推荐答案 + e.Row.RowIndex); } }" + e.Row.RowIndex); } } 如何使用〜/ StuDetails.aspx?Id =+ DataBinder.Eval(Container.DataItem,Id)target =_ blank到位选择How to use "~/StuDetails.aspx?Id="+DataBinder.Eval(Container.DataItem,"Id") target="_blank" in place "Select 提前致谢。"Thanks in advance.用你为SName替换所有的BoundFields和TemplateFiela。Replace all your BoundFields with TemplateFiela as you did for SName. 这篇关于如何在gridview中放置的gridview中为整行设置超链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 09-03 14:18