Tuesday 1 May 2012

if button click should open in new window

When we should press the Title link in Grid view it redirected to related link in new tab:

 <asp:GridView ID="gdv" runat="server" AutoGenerateColumns="false" PageSize="50" 
            onrowcommand="gdv_RowCommand">
    <Columns>
 <asp:TemplateField>
      <ItemTemplate>
        <asp:LinkButton ID="lnk" runat="server" Text='<%# Eval("title") %>' CommandName="Show" CommandArgument='<%#DataBinder.Eval(Container.DataItem,("link"))%>' OnClientClick="document.getElementById('form1').target ='_blank';"></asp:LinkButton>
    </ItemTemplate>
    </asp:TemplateField>
  </Columns>
     </asp:GridView>

No comments:

Post a Comment