Click here to Skip to main content
15,920,438 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
I was created a gridview control, in which i added columns dynamically with datarow as textboxes.
when i bind the datatable in which i created a rows, the rows are disolaying but with blank textbox instead of the text which i writen.
How to resolve it.
Please give me suggestion for this problem.
Thank You.
manognya kota 18-Jan-12 23:04pm    

Can you post the code of your data table and the way you are binding it to gridview.
Prasad_Kulkarni 18-Jan-12 23:17pm    
post your code to get exact result
Sergey Alexandrovich Kryukov 19-Jan-12 1:09am    
Not enough information. Can you see "Improve question" above? This is your only chance to get any useful help.
Jephunneh Malazarte 19-Jan-12 1:30am    
Hello Jagadeesh - you are doing it in DataRowBound?

And I would like to clarify if my understanding is correct to your question.

Question is more like: You have a gridview control which columns will be dynamically generated. However you are facing a challenge when you create a cell(s) that contains textbox inside it, the textbox value is empty?

if that's the case like manognya kota said you might need to change your databinding or perhaps need to check your datasource if the field has a value...
daniele.arrighi 28-Jan-12 14:45pm    
Dinamically created controls are lost between postbacks. So you should try to save the Gridview in the viewstate, so it will be recreated in each cycle OR you'll have to recreate your gridview's DataControlFieldCollection after each postback. But you should post your code first.

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