Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In gridview im having two columns CTY_COUNTRY_ID,CTY_COUNTRY_NAME...country id column is read only and displayed in label country name column is displayed in text box....i use item template for country name...when i click update button after doing changes in textbox following error is occuring..

Unable to cast object of type 'System.Web.UI.LiteralControl' to type 'System.Web.UI.WebControls.TextBox'.



pls give me solution to this...
Posted
Updated 13-Jun-11 21:09pm
v2
Comments
walterhevedeich 14-Jun-11 3:09am    
You might want to post the relevant code.

1 solution

Without seeing the code you are using, it is difficult to be sure, but I suspect that you are doing the equivalent of:
myLabel = myTextBox;
Don't. Try the equivalent of:
myLabel.Text = myTextBox.Text;
 
Share this answer
 
Comments
walterhevedeich 14-Jun-11 4:00am    
Makes sense to me, looking at the error. My 5.
Shahriar Iqbal Chowdhury/Galib 14-Jun-11 4:03am    
nice soln

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