OnClick events for dynamic LinkButton

arian88

New Member
I have a series of Hide/Show LinkButtons dynamically created. Each button corresponds with a GridView. I want to have the OnClick event of the button Hide or Show the GridView. How do I reference the specific corresponding GridView in the HideButtonClick method. I used a counter num to make each LinkButton.ID unique \[code\]ID="hidebutton" + num\[/code\].\[code\] LinkButton lbShow = new LinkButton(); lbShow.ID = "lbShow" + num; lbShow.OnClientClick = "HideCourse_btnClick"; lbShow.CommandArgument = "" + num;\[/code\]And in the event method I want something to the effect of\[code\]protected void HideCourse_btnClick(object sender, EventArgs e){ grdvw1.Visible = false}\[/code\]where the ID grdwv1 is generated by adding the CommandArgument num to the GridView grdvw
 
Back
Top