基於MVC和Bootstrap的權限框架解決方案 一.搭建HTML


因為某些原因,因為需要,最新要做一套客戶管理系統,但是不滿足於僅有的框架。

看了很多大牛寫的框架,強大是強大,代碼也太TM多了,亂七八糟
話不多說,開始吧

隨便在網上找到一套好看的HTML,看起來還不錯,就他了吧

1,新建一個MVC項目,將HTML代碼放入其中,稍作修改,基本就能展示出來了

2,讓他變成動態的,底層我用的我自己的底層框架,大家可以根據自己喜好用就OK,簡單三層就霸道

3,讓其變成動態的,新建\Controllers\CustomerController.cs 控制器,增加代碼

  

public class CustomerController : Controller
    {
        // GET: Customer
        public ActionResult CustomerList()
        {
            BaseBLL<CustomerInfo> bll = new BaseBLL<CustomerInfo>();
            List<CustomerInfo> culist= bll.GetList();//獲取數據庫的客戶列表
            ViewData["List"] = culist;//復制給前台的VIEWDATA
            return View();
        }
    }

 

 4,增加視圖 \Views\Customer\CustomerList.cshtml 加入前台代碼展示數據

  <div class="row-fluid">
        <div class="span12">
            <!-- BEGIN EXAMPLE TABLE widget-->
            <div class="widget">
                <div class="widget-title">
                    <h4><i class="icon-reorder"></i>客戶列表</h4>
                    <span class="tools">
                        <a href="javascript:;" class="icon-chevron-down"></a>
                        <a href="javascript:;" class="icon-remove"></a>
                    </span>
                </div>
                <div class="widget-body">
                    <table class="table table-striped table-bordered" id="sample_1">
                        <thead>
                            <tr>
                                <th style="width:8px;"><input type="checkbox" class="group-checkable" data-set="#sample_1 .checkboxes" /></th>
                                <th>姓名</th>
                                <th class="hidden-phone">郵箱</th>
                                <th class="hidden-phone">欠款</th>
                                <th class="hidden-phone">日期</th>
                                <th class="hidden-phone"></th>
                            </tr>
                        </thead>
                        <tbody>
                            @foreach (CustomerInfo cu in customerList)
                            {
                                <tr class="odd gradeX">
                                    <td><input type="checkbox" class="checkboxes" value="1" /></td>
                                    <td>@cu.Customer_Name</td>
                                    <td class="hidden-phone">@cu.Tel</td>
                                    <td class="hidden-phone">@cu.Fax</td>
                                    <td class="center hidden-phone">2017/03/01</td>
                                    <td class="hidden-phone"><a href="#" class="btn mini purple"><i class="icon-edit"></i> Edit</a></td>
                                </tr>

                            }

                        
                        </tbody>
                    </table>
                </div>
            </div>
            <!-- END EXAMPLE TABLE widget-->
        </div>
    </div>

5,簡單的動態客戶列表就這么完成了!!

 

因剛剛制作完成,代碼還未封裝,將在下一講給出源代碼,非常簡單

下一講:為K2框架增加按鈕

如對本框架感興趣可加群討論 257749427

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM