在网格链接按钮中调用html模式窗体

时间:2015-07-21 10:22:51

标签: c# html asp.net

我试图在网格链接按钮上调用html模式表单,但无法这样做.. 通常,html模态形式就像这样调用

<a href="#fModal" role="button" class="btn btn-default" data-toggle="modal">Modal form</a>

模态表单代码: -

<div class="modal fade" id="fModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>                        
                    <h4>Modal form</h4>
                </div>
                <div class="modal-body modal-body-np">
                    <div class="row">
                        <div class="block-fluid">
                            <div class="row-form clearfix">
                                <div class="col-md-3">First name:</div>
                                <div class="col-md-9"><input type="text" value=""/></div>
                            </div>            
                            <div class="row-form clearfix">
                                <div class="col-md-3">Last name:</div>
                                <div class="col-md-9"><input type="text" value=""/></div>                    
                            </div>                                    
                            <div class="row-form clearfix">
                                <div class="col-md-3">About:</div>
                                <div class="col-md-9"><textarea></textarea></div>
                            </div>                                                
                        </div>                
                        <div class="dr"><span></span></div>
                        <div class="block">                
                            <p>Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet purus. Vivamus hendrerit, dolor at aliquet laoreet.</p>
                        </div>
                    </div>
                </div>   
                <div class="modal-footer">
                    <button class="btn btn-warning" data-dismiss="modal" aria-hidden="true">Save updates</button> 
                    <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>            
                </div>
            </div>
        </div>
    </div>

请建议我如何执行此操作,因为我想将它放在网格中,在编辑模式下显示模型表单,并根据CommandArgument从数据库中提取一些数据。

1 个答案:

答案 0 :(得分:0)

考虑Bootstrap v2.3 +,您应该使用data-target="#fModal"代替href="#fModal",例如:

<a href="javascript:void(0);" role="button" class="btn btn-default" data-toggle="modal" data-target="#fModal">Modal form</a>