日期:2014-05-20  浏览次数:20841 次

.net中gridview的一个问题啊
<asp:GridView ID="GridView1" runat="server" Height="339px" Style="z-index: 100; left: 202px;
  position: absolute; top: 165px" Width="442px" AllowPaging="True" AutoGenerateColumns="False" >
  <Columns >
  <asp:BoundField HeaderText ="username" DataField ="username" />
  <asp:BoundField HeaderText ="theme" DataField ="theme" />
  <asp:BoundField HeaderText ="content" DataField ="content" ItemStyle-Width="150pt" />
  <asp:BoundField HeaderText ="date" DataField ="date" />
  <asp:HyperLinkField HeaderText ="edit" NavigateUrl="~/detials.aspx?name='"+this.+"'" Text="view"/>
  </Columns>
  </asp:GridView>

如上,我是想在点击HyperLinkField的时候,讲这一行的username传到目标网页去。请问该怎么写啊 


------解决方案--------------------
HyperLinkField 的属性里面 设置一下 :
 DataNavigateUrlFields="username" 
 DataNavigateUrlFormatString="detials.aspx?username={0}"

另外在页面中 DataKeyNames="username"