使用前面引导模式中C#后面定义的按钮 [英] Use the button defined behind in C# in front bootstrap modal
问题描述
我写了这个后,我点击打开模式按钮后会出现一个浮动窗口。
< button type =buttonclass =btn btn-infodata-toggle =modaldata-target =#myModal> Open Modal< / button>
< div id =myModalclass =modal faderole =dialog>
< div class =modal-dialog>
< div class =modal-content>
< div class =modal-header>
< button type =buttonclass =closedata-dismiss =modal>& times;< / button>
< h4 class =modal-title>模态头< / h4>
< / div>
< div class =modal-bodyid =imghere>
< / div>
< div class =modal-footer>
< button type =buttonclass =btn btn-defaultdata-dismiss =modal>关闭< / button>
< / div>
< / div>
< / div>
< / div>
在这个例子中,我用
< button type =buttonclass =btn btn-infodata-toggle =modaldata-target =#myModal>打开模态< / button>
后面的C#循环
保存无效的GenGridView(){var data = project.ObtainDataDescJSON();标题=show; for(int rowCtr = 0; row< data.Num.Count; row ++){var buttonField = new ButtonField {ButtonType = ButtonType.Button,Text =Show,CommandName =Display}; ModelNumFieldsGrid.Columns.Add(ButtonField字段);打破;如何使用我在C#中定义的这些按钮?自举模态?我应该如何改变
>
< button type =buttonclass =btn btn-infodata-toggle =modaldata -target =#myModal> Open Modal< / button>
我应该使用类似get元素的ID吗?我真的很新开发Web,请帮忙!谢谢
您可以使用常规按钮,而不是按钮字段,但是这应该这样做。或者你可以使用jQuery来查找你添加的所有按钮,并以这种方式附加属性(首选)。
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 =显示,
CommandName =显示
};
buttonField.Attributes.Add(data-toggle,modal);
buttonField.Attributes.Add(data-target,#myModal);
buttonField.CssClass =btn btn-info;
ModelNumFieldsGrid.Columns.Add(buttonField);
休息;
}
}
I write this to have a floating window shows up after I click open modal button
<button type="button" class="btn btn-info" data-toggle="modal" data-target="#myModal">Open Modal</button>
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body" id="imghere">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
in this example, I defined the button with
<button type="button" class="btn btn-info" data-toggle="modal" data-target="#myModal">Open Modal</button>
Now I have a button defined in C# loop in behind
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"
};
ModelNumFieldsGrid.Columns.Add(buttonField);
break;
}
}
How can I use these buttons I defined in C# in the bootstrap modal? How should I change the
<button type="button" class="btn btn-info" data-toggle="modal" data-target="#myModal">Open Modal</button>
should I use something like get element By ID? I really new to Web developing, please help! Thanks
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;
}
}
这篇关于使用前面引导模式中C#后面定义的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!