Click here to Skip to main content
15,921,279 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have one bound field with DataField="Status" in grid view..
now in my code page i want to access that value..
i am trying as

C#
BoundField Status= (BoundField)e.Row.FindControl("Status");


its giving error
Posted
Updated 27-Sep-10 2:55am
v2
Comments
[no name] 27-Sep-10 8:50am    
and what is the error?
Hiren solanki 27-Sep-10 8:54am    
Kindly State the technology, Either ASP.net or WinForms ?
Henry Minute 27-Sep-10 8:56am    
I have tagged your question with ASP.Net as that seemed most likely. Please edit your question to correct that if it is incorrect.

I think the Bound Field itself doesn't have any ID.

How you have Applied "Status"(id of Bound Field) ?

and Bound Filed renders itself as a <td> Element.

So I think you can probably find ( if it is checkbox )

C#
CheckBox cBox =  gridView.Rows[0].Cells[0].Controls[0] as CheckBox;


Please vote and Accept Answer if it Helped.
 
Share this answer
 
BoundField is available depending on Where are you trying to access BoundField?

You might be interested in this
 
Share this answer
 
hi,

what i understand is that you are accesing this control in rowdatabound

you might be missing row type check.

VB
e.Row.RowType = DataControlRowType.DataRow


for details pleaese check
http://forums.asp.net/p/1088037/1624163.aspx[^]

thanks
 
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