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 330409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T09:40:43+00:00 2026-05-12T09:40:43+00:00

I need to create an asp.net page that auto generate a brackets tournament tennis

  • 0

I need to create an asp.net page that auto generate a brackets tournament tennis style.
Regarding the managing of match in database, it’s not a problem.

The problem is the dynamic graphics creation of brackets.
The user will be able to create tournament by 2-4…32 players.
And i don’t know ho to create the graphics bracket in html or gdi…

  • 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-12T09:40:43+00:00Added an answer on May 12, 2026 at 9:40 am

    Using Silverlight, and a Grid, You can produce something like this:
    bracket display

    To do it, define a regular UserControl containing a Grid. (This is the default when you build a silverlight app in VS2008 with the Silverlight 3.0 SDK).

    Then, add a call to the following in the constructor for the user control:

    private void SetupBracket(int n)
    {
        var black = new SolidColorBrush(Colors.Gray);
        // number of levels, or rounds, in the single-elim tourney
        int levels = (int)Math.Log(n, 2) + 1;
        // number of columns in the Grid.  There's a "connector"
        // column between round n and round n+1.
        int nColumns = levels * 2 - 1;
    
        // add the necessary columns to the grid
        var cdc = LayoutRoot.ColumnDefinitions;
        for (int i = 0; i < nColumns; i++)
        {
            var cd = new ColumnDefinition();
            // the width of the connector is half that of the regular columns
            int width = ((i % 2) == 1) ? 1 : 2;
            cd.Width = new GridLength(width, GridUnitType.Star);
            cdc.Add(cd);
        }
        var rdc = LayoutRoot.RowDefinitions;
    
        // in the grid, there is one row for each player, and 
        // an interleaving row between each pair of players. 
        int totalSlots = 2 * n - 1;
        for (int i = 0; i < totalSlots; i++)
        {
            rdc.Add(new RowDefinition());
        }
    
        // Now we have a grid of the proper geometry.  
        // Next: fill it. 
    
        List<int> slots = new List<int>();
        ImageBrush brush = new ImageBrush();
        brush.ImageSource = new BitmapImage(new Uri("Bridge.png", UriKind.Relative));
    
        // one loop for each level, or "round" in the tourney.  
        for (int j = 0; j < levels; j++)
        {
            // Figure the number of players in the current round.
            // Since we insert the rounds in the reverse order, 
            // think of j as the "number of rounds remaining."
            // Therefore, when j==0, playersThisRound=1.  
            // When j == 1, playersThisRound = 2.  etc.
            int playersThisRound = (int)Math.Pow(2, j);
    
            int x = levels - j;
            int f = (int)Math.Pow(2, x - 1);
    
            for (int i = 0; i < playersThisRound; i++)
            {
                // do this in reverse order.  The innermost round is 
                // inserted first.
                var r = new TextBox();
                r.Background = black;
                if (j == levels - 1)
                    r.Text = "player " + (i + 1).ToString();
                else
                    r.Text = "player ??";
    
                // for j == 0, this is the last column in the grid.
                // for j == levels-1, this is the first column.
                // The grid column is not the same as the current
                // round, because of the columns used for the 
                // interleaved connectors.
                int k = 2 * (x - 1); 
                r.SetValue(Grid.ColumnProperty, k);
    
                int m = (i * 2 + 1) * f - 1;
                r.SetValue(Grid.RowProperty, m);
                LayoutRoot.Children.Add(r);
    
                // are we not on the last round? 
                if (j > 0)
                {
                    slots.Add(m);
                    // Have we just inserted two rows?  Then we need
                    // a connector between these two and the next 
                    // round (the round previously added).
                    if (slots.Count == 2)
                    {
                        string xamlTriangle = "<Path xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' "+
                                              "xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml' " +
                                              "Data='M0,0 L 100 50 0 100 Z' Fill='LightBlue' Stretch='Fill'/>";
    
                        Path path = (Path)System.Windows.Markup.XamlReader.Load(xamlTriangle);
    
                        path.SetValue(Grid.ColumnProperty, 2 * (x - 1) + 1);
                        path.SetValue(Grid.RowProperty, slots[0]);
                        path.SetValue(Grid.RowSpanProperty, slots[1] - slots[0] + 1);
                        this.LayoutRoot.Children.Add(path);
                        slots.Clear();
                    }
                }
    
            }
        }
    }
    

    In the above, the connector is just an isosceles triangle, with the apex pointing to the right. It is generated by XamlReader.Load() on a string.

    You would also want to pretty it up, style it with different colors and fonts, I guess.

    You can insert this silverlight “user control” into any HTML web page, something like embedding a flash app into a page. There are silverlight plugins for IE, Firefox, Opera, Safari, and Chrome.

    If you don’t want to use Silverlight, you could use a similar approach to construct an HTML table.

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

Sidebar

Related Questions

I need to create a nested linkbuttons in a asp.net page that looks like
I need to create a link for an ASP.NET page that has an image
I need to create an ASP.net page that has a control on the page
I need to create a subscription for my SSRS reports in an asp.net page.
I am using FckEditor in Create.aspx page in asp.net mvc application. Since I need
I am working on an ASP.net page that also users ChartFX. I need to
I'm trying to create a routine in my asp.net's main page that will see
I'm creating a login page. I want to create ASP.NET TextBox controls that have
i have to create one asp.net mvc page that will show template of controls.
We need to create an .xls file in ASP .NET which will be imported

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.