Help with Gridview and templatefield column

R

Rafia Tapia

Hi
I have a gridview control that is showing 6 column. The first column is a
buttonfield, then there are three boundfield and two template field control.
I am creating all these column in the page load event and initializing the
itemtemplate of the template field in rowcreated event. The problem is that
my templatefield shows a textbox and the value of the textbox in not retain
between postback.

Can anyone please help me.
Thanks
 
M

Masudur

Hi
I have a gridview control that is showing 6 column. The first column is a
buttonfield, then there are three boundfield and two template field control.
I am creating all these column in the page load event and initializing the
itemtemplate of the template field in rowcreated event. The problem is that
my templatefield shows a textbox and the value of the textbox in not retain
between postback.

Can anyone please help me.
Thanks

Hi... please override the oninit
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
BoundColumn column = new BoundColumn();
///your code goes here
gdvData.Columns.Add(column);
///your code goes here
}
and add all the column template and bound both in onInit...

The thing is dynamically added control does not persists on pages
control tree... after post back... so you got to make sure that every
thing again in place to persists the value of the controls....

Thanks
Md. Masudur Rahman (Munna)
Kaz Software Ltd.
www.kaz.com.bd
http://munnacs.110mb.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top