suresh

suresh

  • NA
  • 293
  • 0

LinkButton event is not firing in DataGrid

Oct 15 2012 12:47 PM

Hi,
Below is the code the linkbutton is not firing the event.

 <asp:DataGrid ID="user_info" DataKeyField="c_id" runat="server" >
    <Columns>       
     <ItemTemplate>
        <asp:LinkButton ID="lnkbtn" CommandName="cmdview" OnCommand="lnkbtn_Command" runat="server" Text="View"  ></asp:LinkButton>
        </ItemTemplate>
    </Columns>       
   </asp:DataGrid>

 protected void lnkbtn_Command(Object sender, CommandEventArgs e)
    {
        if (e.CommandName == "cmdview")
        {
            Response.Redirect("http://google.com");
        }
    }

Please help me,
Thanks

Answers (2)