2014年5月27日 星期二

ASP.NET How to give the postbackurl in gridview link button

ASP.NET How to give the postbackurl in gridview link button


HTML:
  1. <asp:GridView ID="GridView1" runat="server"  CellPadding="4" ForeColor="#333333" GridLines="None" AutoGenerateColumns="false">
  2.                         <Columns>
  3.                             <asp:TemplateField HeaderText="Model">
  4.                                 <ItemStyle HorizontalAlign="Center" Width="200" />
  5.                                 <ItemTemplate>
  6.                                     <asp:LinkButton ID="lnkGvmodel" runat="server" Text='<%# Bind("model") %>' CommandArgument='<%# Eval("model") %>' PostBackUrl='<%# String.Format("~/ats/model.aspx?model={0}", Eval("model"))%>'></asp:LinkButton>
  7.                                 </ItemTemplate>
  8.                             </asp:TemplateField>
  9.                             </Columns>
  10.  
  11. </asp:GridView>

沒有留言:

張貼留言