Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
In gridview template field,
(TextBox)e.Row.FindControl("TextBox13") = ?

How to assign values for this from datatable.
Posted
Comments
King Fisher 4-Mar-15 4:16am    
not clear.
Tushar sangani 4-Mar-15 7:53am    
i think the you want to bind text box.
if yes bind the grid and in template field text='<%# eval ('column Name')%>'
else improve your question

1 solution

Hi,

Try this:
C#
//DataTable Object
DataTable dt = new DataTable();
//Find textbox control
TextBox txtId = (TextBox)e.Row.FindControl("txtId");
//Lets say u want the data from the first row. U can use loop here
DataRow dr = dt.Rows[0];
txtId.Text = Convert.ToString(dr["ColumnName"]);
 
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