动态添加到TabPage时没有显示dataGridView

时间:2016-06-22 15:23:50

标签: c# datagridview tabpage

我遇到了一个问题 - 当我尝试将我的dataGridView添加到我动态创建的新TabPage时,dataGridView仅显示在1 private void button5_Click(object sender, EventArgs e) { withoutChildren(treeView1.TopNode); int index = 0; foreach (TreeNode tn in ta) { TabPage tp = new TabPage(); tp.Location = new System.Drawing.Point(4, 22); tp.Name = tn.Name.ToString(); tp.Padding = new System.Windows.Forms.Padding(3); tp.Size = new System.Drawing.Size(579, 164); tp.TabIndex =index; tp.Text = tn.Name.ToString(); tp.UseVisualStyleBackColor = true; tp.Controls.Add(dataGridView2); tabControl1.TabPages.Add(tp); index++; } } 上,而不是显示在所有页面上,如您所见the screenshot。我该如何解决这个问题?

  <div class="col-md-6 col-md-offset-3 text-center">
        @Html.Partial("_Registration", Model)
        <div class="text-left">
            <div class="form-group">
                @Html.Kendo().CheckBoxFor(x => x.Field1).HtmlAttributes(new { @class = "form-control text-center" })
            </div>
            <div class="form-group">
                @Html.Kendo().CheckBoxFor(x => x.Field2).HtmlAttributes(new { @class = "form-control text-center" })
            </div>
            <div class="form-group">
                @Html.Kendo().CheckBoxFor(x => x.Field3).HtmlAttributes(new { @class = "form-control text-center" })
            </div>
        </div>
        <div class="form-group">
            <input type="reset" id="btnReset" class="btn btn-primary" value="Reset" />
            <input type="submit" id="btnSubmit" class="btn btn-primary" value="Submit" />
        </div>
    </div>

0 个答案:

没有答案