arvindasp says:
<
asp:TemplateField
ItemStyle-HorizontalAlign
=
"Center"
HeaderText
=
"Select"
>
<
ItemTemplate
>
<
asp:Button
ID
=
"btnSelectItemPl"
CssClass
=
"btn btn-primary Button-Height-user"
runat
=
"server"
Text
=
"Select"
CommandArgument="<%#((GridViewRow)Container).RowIndex%>"
CommandName="ShareItem" />
</
ItemTemplate
>
</
asp:TemplateField
>
The Command Name you set as ShareItem and in code you are checking with btnSelectItemPl i.e. the id of the control.
Change with below code and check.
protected void GvShareListPl_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "ShareItem")
{
int index = Int32.Parse(e.CommandArgument.ToString());
GridViewRow row = GvShareListPl.Rows[index];
TxtShareItemCodePl.Text = row.Cells[3].Text;
ModalPopupShareValue.Show();
}
}