asp.net 动态创建DIV

这篇博客讲述了在ASP.NET中如何根据用户需求动态创建DIV,特别是在用户添加角色并指定兼职时。内容涉及从数据库中获取角色信息,并在前端进行动态显示,同时涵盖了将用户信息保存到数据库的操作。
摘要由CSDN通过智能技术生成

需求:用户添加角色时,需要添加兼职。兼职角色,动态添加。角色信息从数据库中读取。

前台代码:动态添加

<div title="兼职">
                        <div id="divAddElseRole">
                            <div style="margin-top: 10px;">
                                <label style="margin-left: 55px;">所属组织:</label>
                                <label id="currentAddOrganization">教育学院</label>
                                <label style="margin-left: 85px;">当前角色:</label>
                                <label id="currentAddRole">管理员</label>
                                <a href="#" class="easyui-linkbutton" style="margin-left: 90px;" data-options="plain:true" οnclick="AddElseRole()">【添加兼职】</a>
                                <hr />
                            </div>
                        </div>
                    </div>

//添加用户时,添加兼职
        function AddElseRole() {
            //获得现有的下拉框
            var ElseRoles = document.getElementsByClassName("selectElseRoles");
            //如果没有下拉框,则select从0开始编号
            var roleData;
            var message = document.getElementById("WarnMessage");
            if (ElseRoles.length == 0) {
                $("#divAddElseRole").append("<div style='margin-top:5px;margin-bottom:5px;'><label style='margin-left:60px;'>兼职角色</label> <select class='selectElseRoles' id ='selectElseRole1' style='width:134px;height:20px;margin-left:110px;'
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值