Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7537097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:45:22+00:00 2026-05-30T06:45:22+00:00

I am wring a button control like below. i have got a method that

  • 0

I am wring a button control like below.
i have got a method that has got a little code like below i mentioned.
i tried it in two ways but both don’t work. onw with btn object, second with direct writing it.
i need to create all three buttons on run times for N number of items, ans all buttons will have some common things except there identity. Please suggest me a little how to make it work.

 Button btn = new Button();
            btn.ID = "btnDress" + x;
            btn.CommandName = "DressBtn";
            btn.Text = "Dressing";
            btn.CommandArgument = x.ToString();
            btn.UseSubmitBehavior = true;
            btn.Click += new EventHandler(btnDress_Click);

void draw()
{
 drawItem = drawItem + @" <div class=new_options>
                    <ul>
                        <li>
                            "+btn+ @"</li>
                        <li>
                            <asp:Button ID='btnSpInst_'" + x + @" runat='server' CommandName='SpeInstBtn' Text='Special Instruction'
                                OnClick='btnDress_Click' CommandArgument='" + x + @"' /></li>
                        <li>
                            <asp:Button ID='btnTopp_'" + x + @" runat='server' CommandName='ToppBtn' Text='Toppings' OnClick='btnDress_Click' CommandArgument='" + x + @"' /></li>
                    </ul>
                    <div class='clear'>
                    </div>";

            x++;
}

the problem with this code is that for ever div i need to write 3 buttons on fly which has got some fix parameters, like i mentioned for the asp buttons which i tried to farm but those write as an string and don’t work, could some body tell me how can i achieve the above thing to work.

this is the html which i need to redraw for items. on fly, here i have kept button but in reality i want to generate it on fly.

 <div class="new_options">
                    <ul>
                        <li>
                            <asp:Button ID="Button4" runat="server"   Visible="true" CommandName="DressBtn" Text="Dressing" OnClick="btnDress_Click" /></li>
                        <li>
                            <asp:Button ID="Button5" runat="server" Visible="true" CommandName="SpeInstBtn" Text="Special Instruction"
                                OnClick="btnDress_Click" /></li>
                        <li>
                            <asp:Button ID="Button6" runat="server" CommandName="ToppBtn" Visible="true" Text="Toppings" OnClick="btnDress_Click" /></li>
                    </ul>
                    <div class="clear">
                    </div>
                </div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T06:45:24+00:00Added an answer on May 30, 2026 at 6:45 am

    Do this from the code behind. Build the control like you started to here, and then choose somewhere on your page to place it into… something like someContainerControl.Controls.Add(MyNewButton);

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom control with bindings like below <DataTemplate DataType={x:Type vm:EditorTabViewModel}> <me:MarkdownEditor Options={Binding
Code like this with button in footer template after clicking that button error appears:
I am attempting to create a Tab Control Style that basically looks like buttons
I have a simple style for label controls. I'd like to define a control
I have a user control that needs to load a child control when a
I have the following button with associated context menu <div class=control-action> <button>Action</button> <ul style=display:none>
I have a masterpage with a sidebar that conatians an accordion control for site
I must have pressed on the wrong button at some point, and now when
I want to make a custom container, usable in MXML like: <local:MyContainer> <s:Label/> <s:Button/>
In my Air traffic Control application, I am trying to land two planes in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.