Click here to Skip to main content
15,907,497 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In Gridview as follows


Room Course Room Course

11 Linkbtn 21 Linkbtn
12 Linkbtn 22 Linkbtn
13 Linkbtn 23 Linkbtn
14 Linkbtn 24 Linkbtn


i have one button called Hidelinkbutton. when i click that hidelinkbutton i want in Gridview all the Linkbtn to be visible false.


for that how can do using csharp.


I tried my code as follows


protected void Hidelinkbutton_Click(object sender, EventArgs e)
{

GridView row = gvClassRooms.Rows[0];
((LinkButton)row.FindControl("lnkRoom1")).Visible = false;

GridView row = gvClassRooms.Rows[1];
((LinkButton)row.FindControl("lnkRoom1")).Visible = false;


GridView row = gvClassRooms.Rows[2];
((LinkButton)row.FindControl("lnkRoom1")).Visible = false;


GridView row = gvClassRooms.Rows[3];
((LinkButton)row.FindControl("lnkRoom1")).Visible = false;

}



when i run the above code shows error as follows,

Cannot implicitly convert type 'System.Web.UI.WebControls.GridViewRow' to 'System.Web.UI.WebControls.GridView'


please help me. what is the problem in my above code.


Rgds,
Narasiman P.
Posted

1 solution

Apparently gvClassRooms.Rows[0] (and the others) returns a System.Web.UI.WebControls.GridViewRow object, and not a System.Web.UI.WebControls.GridView.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900