link invisible in gridview row

Posted by Oswaldlily under ASP.NET on 5/8/2013 | Points: 10 | Views : 643 | Status : [Member] | Replies : 1
I have 2 linkbutton-link1 and link2 in single column in rows of gridview..

In footer row,i has button(insert) for inserting rows on inserted successfuully,
my link1 shd be visible and link2 shd be made false..

following code not works

protected void lnkadd_Click(object sender, EventArgs e)
{

System.Threading.Thread thread = new System.Threading.Thread(new System.Threading.ThreadStart(() => { ThreadMethod(sender); }));
//System.Threading.Thread thread = new System.Threading.Thread(new System.Threading.ThreadStart(ThreadMethod(sender)));
thread.SetApartmentState(System.Threading.ApartmentState.STA);
thread.Start();
}

public void ThreadMethod(object sender)
{
GridViewRow gvrow = ((Control)sender).Parent.Parent as GridViewRow;
int rowindex = gvrow.RowIndex;

LinkButton lnkAdd = (LinkButton)gv.Rows[rowindex].Cells[19].FindControl("lnkAdd");
LinkButton lnkView = (LinkButton)gv.Rows[rowindex].Cells[19].FindControl("lnkView");
lnkAdd.Visible = false;
lnkView.Visible = true;
}




Responses

Posted by: Kmandapalli on: 5/8/2013 [Member] Silver | Points: 25

Up
0
Down
Hi,

Your adding theses link controls initially in your aspx page.
So, there only by default you need to set the visibility of both the links as false.

Regards,
Shree M.


Kavya Shree Mandapalli

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response