Click here to Skip to main content
16,004,727 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am iterating like this


C#
  foreach (Control c in gvFormula.Rows[gvFormula.EditIndex].Controls)
{
// How to make use of this loop
}
Posted
Comments
[no name] 24-Sep-13 11:47am    
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.textbox.readonly.aspx/css
Bhagavan Raju M 24-Sep-13 11:50am    
Predefine I set controls to false now I want set each readonly=false by using gridview row index
[no name] 24-Sep-13 11:56am    
If it's already false then what is the point of setting the property to false again?
Bhagavan Raju M 24-Sep-13 12:00pm    
Sorry typing error I have to set it to True.
[no name] 24-Sep-13 12:03pm    
Okay then set it to true.

1 solution

I think the right way to go is


C#
foreach (GridviewRow row in gvFormula.Rows)
{
    //should you have a TextBox called txt1
    ((TextBox)row.FindControl("txt1")).ReadOnly = true;
    //or if you need invisible
    ((TextBox)row.FindControl("txt1")).Visible = false;
    
    //and so on and so on...
}


You can also use it on RowDataBound event if you need
 
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