Geeks With Blogs

News

Microsoft MVP


DZone MVB


Moderator at CodeASP.NET


Quiz Master







free counters
Free counters
Added on January 19,2012


Follow Me @vmsdurano

A bit About Me



Disclaimer
The opinions expressed herein are my own personal opinions and does not represent the opinions of my employers. Nor does it represent the opinion of my dog, because I don’t have one.


Vinz' Blog (ProudMonkey) "Code, Beer and Music ~ my way of being a programmer"

If you are working with GridView BoundField Columns and wanted to access the TextBox control on row editing for whatever reasons (which means when you click on the Edit link) then below is an example on how to do it.

Let say for example you need to change the BackColor of the TextBox on edit mode. So at  PreRender event of GridView, you can do something like this:

protected void GridView1_PreRender(object sender, EventArgs e) { 
            if (this.GridView1.EditIndex != -1) { 
                TextBox tb = (TextBox)GridView1.Rows[GridView1.EditIndex].Cells[1].Controls[0]; 
                tb.BackColor = System.Drawing.Color.Blue; 
            } 
}

 

That's simple! I hope someone find this post useful!

Technorati Tags: ,,


		        
		
			Posted on Wednesday, July 14, 2010 11:42 PM


		ASP.NET
	, 
		Tips&Tricks
	, 
		GridView
	
 | Back to top
		
		


Comments on this post: GridView BoundField Column: Accessing TextBox Control on Edit Mode

comments powered by Disqus

Copyright © Vincent Maverick Durano | Powered by: GeeksWithBlogs.net