Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Populate textbox in gridview itemtemplate

Status
Not open for further replies.

nzcam

Programmer
Mar 5, 2003
36
0
0
NZ
I have a gridview with multiple columns, One of the columns is set to a itemtemplate and holds a textbox.

I can easily get the text from the textbox using

TextBox txTitle = ((TextBox)gvRow.Cells[1].Controls[1]);
Title = txTitle.Text;

I am trying to set the same textbox to a string, but cannot!

How is this done?

Thanks
 
I cant figure this out!

I do not know how to do it at all!
 
I am getting the text by these 2 lines.

TextBox txTitle = ((TextBox)gvRow.Cells[1].Controls[1]);
Title = txTitle.Text;

What I cant figure out is how to place a string into the textbox held within the gridview row column that has a textbox in an itemtemplate field.

It not quite that easy!

Any ideas!
 
It is that easy... you have the code done already. Instead of getting the value, set the value as Mark has stated.
 
Great, after looking again and thinking about I released that I only assigned a reference to the itemtemplate textbox. Therefore I could just go txTitle.Text = "" as suggested by you both.


Thanks to you both, and silly me
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top