Jon,
I agree, that would be the best solution.
--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Jon Skeet [C# MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
Dennis Myrén <(E-Mail Removed)> wrote:
> If your buttons name's follow a pattern, you can use an indexer and loop
> like this.
> Button button = null;
> int buttonIndex = 0x1;
> while (null != (button = base.FindControl(string.Concat("Button",
> buttonIndex ++.ToString())) as Button))
> {
> button.BackColor = System.Drawing.Color.Azure;
> }
Or, much better IMO, would be to have an array of buttons:
Button[] buttons = new Button[50];
Then create the buttons dynamically (rather than with the designer),
say from a list of strings. Then it's really easy to add a particular
event handler to all buttons, etc.
--
Jon Skeet - <(E-Mail Removed)>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too