Problem with dynamically created template columns and updatecomman

G

Guest

I have a problem with editable datagrid and was hoping if anyone could help
me. Please help me if possible.

I have an editable datagrid, whose column count I don’t know until runtime.
I am sure of 3 columns Id,Name and Description.

But there also might be more. So I add these 3 columns and an
editcommandbutton and deletecommnadbutton at design time.

Then during runtime I insert my other columns that I need, in between
Description and Edit columns.

I need checkboxes in these dynamically created template columns. So I
implement the ITemplate interface and the databinding works just fine. I give
Ids for both checkboxes in Itemtemplate as well as EditItemTemplate.

Now, when I say Update, in updatecommand event handler, I am not able to
find the checkbox controls that I created for EditItemTemplate.

I tried adding columns at every pageload, even then I can’t find the controls.

Can anybody please help me in achieving this. It is urgent :(

TIA
Suma.
 
J

John Saunders

Suma said:
I have a problem with editable datagrid and was hoping if anyone could
help
me. Please help me if possible.

I have an editable datagrid, whose column count I don't know until
runtime.
I am sure of 3 columns Id,Name and Description.

But there also might be more. So I add these 3 columns and an
editcommandbutton and deletecommnadbutton at design time.

Then during runtime I insert my other columns that I need, in between
Description and Edit columns.

I need checkboxes in these dynamically created template columns. So I
implement the ITemplate interface and the databinding works just fine. I
give
Ids for both checkboxes in Itemtemplate as well as EditItemTemplate.

Now, when I say Update, in updatecommand event handler, I am not able to
find the checkbox controls that I created for EditItemTemplate.

I tried adding columns at every pageload, even then I can't find the
controls.

Can anybody please help me in achieving this. It is urgent :(

Turn on page tracing, which will show you the control tree. See if the
checkboxes are there, what they're within and what they're called.

John Saunders
 
G

Guest

I got the solution.
Actually once I get my column lists during my first page load, I need to
store them in session.Then in Page_Init need to add dynamic template columns
again by retreiving them from session.
This way my code works just fine :)

Suma.
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top