Change the visible sate of a link button inside a datalist

79 views Asked by At

I want to change the visible state and enable state of a link button inside a data list when another button in the same data list is clicked.How can I do that?

Here is the code:

if (e.CommandName == "Save")
{
    DataListItem item = (DataListItem)(((LinkButton)(e.CommandSource)).NamingContainer);
    LinkButton lnk=(LinkButton)item.FindControl("LinkButton2");
    lnk.Visible=false;
}

This code is not working

1

There are 1 answers

0
Krsna Kishore On

Hello I am a bit late in answering this but for Linkbutton to change its visible state by using display:none

 lnk.Attributes.Add("style", "display:none");