Skip to content Skip to sidebar Skip to footer

Use The Button Defined Behind In C# In Front Bootstrap Modal

I write this to have a floating window shows up after I click open modal button

Solution 1:

You could just use a regular button, not a button field but either way this should do it. Or you can just use jQuery to find all of the buttons you added and attach the attributes that way (preferred).

protected void GenGridView()
    {
        var data = project.ObtainDataDescJSON();
        Title = "show";
        for (int rowCtr = 0; row < data.Num.Count; row++)
        {
            var buttonField = new ButtonField
            {
                ButtonType = ButtonType.Button,
                Text = "Show",
                CommandName = "Display"

            };

            buttonField.Attributes.Add("data-toggle", "modal");
            buttonField.Attributes.Add("data-target", "#myModal");
            buttonField.CssClass = "btn btn-info";             

            ModelNumFieldsGrid.Columns.Add(buttonField);
            break;
        }
      }

Solution 2:

System.Web.UI.ScriptManager.RegisterStartupScript(this, this.GetType(), "modelBox", "$('#myModal').modal('show');", true);

Post a Comment for "Use The Button Defined Behind In C# In Front Bootstrap Modal"