Click here to Skip to main content
15,903,203 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to edit item template in a griview on rowediting event.i assign value to edit item template on code behind.the code is:
((TextBox)objGridViewRow.Cells[2].FindControl("txtFName")).Text = obj.FullName;
txtFName is the edit item template.butwhile assigning value to this, nullReference Exception arises.how can i do this..help me..
Posted

1 solution

use this i think it will help you

C#
((TextBox)objGridViewRow.FindControl("txtFName"))")).Text = obj.FullName==null ? "" : obj.FullName;

check that what will come in obj.FullName value check it is null or not.
 
Share this answer
 
Comments
Member 8496104 2-Jun-12 4:07am    
obj.FullName contain a value

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