Add a button without adding it to design

R

Richard

I'm making an ASP.NET project in C#, in Visual studio 2003, but when I add
it only from the code, then I can't catch the event, but when I add it to
the design I can catch it. the problem is that it isn't predefined how many
buttons I want, so I can't add them to design, How do I solve this problem??

Regards Richard
 
J

Jos

Richard said:
I'm making an ASP.NET project in C#, in Visual studio 2003, but when
I add it only from the code, then I can't catch the event, but when I
add it to the design I can catch it. the problem is that it isn't
predefined how many buttons I want, so I can't add them to design,
How do I solve this problem??

Dynamic buttons only work when they are re-created on postback.

So, just make sure that on postback, you run the same code to
get the same number of buttons.
 
R

Richard

Dynamic buttons only work when they are re-created on postback.
So, just make sure that on postback, you run the same code to
get the same number of buttons.

Thanks, I figured it out in another newsgroup, you can also add more
buttons, just make sure to give them a unique identifier;
 
R

Robert Koritnik

And to recreate them as late as in Page load event handler. After that they
won't fire events.
 

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
474,141
Messages
2,570,813
Members
47,357
Latest member
sitele8746

Latest Threads

Top