博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
关于界面和后台一些简单操作
阅读量:4591 次
发布时间:2019-06-09

本文共 7298 字,大约阅读时间需要 24 分钟。

界面部分:

<head runat="server">

    <title></title>
    <script src="http://www.cnblogs.com/Javascript/jquery-1.4.1.min.js" type="text/javascript"></script>
    <script src="http://www.cnblogs.com/Javascript/jquery.zxxbox.3.0.js" type="text/javascript"></script>
    <link href="http://www.cnblogs.com/Css/StyleSheet.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        function indexDepar(value, width, height, Name) {
            document.getElementById("myframe").src = value;
            document.getElementById("myframe").width = width;
            document.getElementById("myframe").height = height;
            $("#login").zxxbox({ title: Name });
        }
    </script>
</head> 

<body>

<form id="form1" runat="server">

    <input type="hidden" id="IDInfo" runat="server" />
    <div id="login" style="padding: 5px; display: none;">
        <iframe id="myframe" src="#" width="auto" frameborder="no" border="0" framespacing="0">
        </iframe>
    </div>

 <div class="tit_but">

                            <telerik:RadButton ID="btnAdd" runat="server" CommandName="新增" AutoPostBack="false">
                             <Image ImageUrl="http://images.cnblogs.com/icon/add.gif" HoveredImageUrl="http://images.cnblogs.com/icon/add_b.gif"
                                        IsBackgroundImage="true" />
                            </telerik:RadButton>
                            <telerik:RadButton ID="btnUp" runat="server" CommandName="审核"
                            OnClick="btnUp_Click" onclientclicking="btnUpClick">
                            <Image ImageUrl="http://images.cnblogs.com/icon/checked.gif" HoveredImageUrl="http://images.cnblogs.com/icon/checked_b.gif"
                                        IsBackgroundImage="true" />
                            </telerik:RadButton>
                            <telerik:RadButton ID="btnDetele" runat="server" CommandName="删除"
                            OnClick="btnDetele_Click" onclientclicking="onDeleteClick">
                              <Image ImageUrl="http://images.cnblogs.com/icon/del.gif" HoveredImageUrl="http://images.cnblogs.com/icon/del_b.gif"
                                        IsBackgroundImage="true" />
                            </telerik:RadButton>
                            <telerik:RadButton ID="btnUpdate" runat="server" CommandName="修改" AutoPostBack="false">
                            <Image ImageUrl="http://images.cnblogs.com/icon/update.gif" HoveredImageUrl="http://images.cnblogs.com/icon/update_b.gif"
                                        IsBackgroundImage="true" />
                            </telerik:RadButton>
   </div>

<telerik:RadGrid ID="Grid_ApplyAuthorized" runat="server" PageSize="10" AllowPaging="true" Width="100%"

         AllowSorting="true" AllowMultiRowSelection="false" OnNeedDataSource="Grid_ApplyAuthorized_NeedDataSource"
          OnPageIndexChanged="Grid_ApplyAuthorized_PageIndexChanged" OnPageSizeChanged="Grid_ApplyAuthorized_PageSizeChanged">
  <MasterTableView AutoGenerateColumns="false" DataKeyNames="Id">
          <Columns>
              <telerik:GridTemplateColumn HeaderText="选择">
                  <HeaderTemplate>
                      <input type="checkbox" id="AllCheck" />
                      </HeaderTemplate>
                       <ItemTemplate>
                      <input type="checkbox" name="ChecInfo" value='<%#Eval("Id") %>' style='display: <%#Eval("CheckStatus").ToString()=="0"?"":"none"%>' />当数据不能更改之后 把复选框隐藏
                      </ItemTemplate>
                       </telerik:GridTemplateColumn>

   </Columns>

  </MasterTableView>
 </telerik:RadGrid>

</form>

关于jquery

<script type="text/javascript">

        var temp = "";
        $("#AllCheck").click(function () {
            $("input[name='ChecInfo']").attr("checked", $(this).attr("checked"));
        });
        function onDeleteClick(sender, args) {
            temp = "";
            $("input[name='ChecInfo']").each(function () {
                if (this.checked && $(this).css("display") != "none")当复选框隐藏的时候就不在需要它的ID
                    temp += $(this).val() + "^";
            });
            if (temp == "") {
                alert("请选择要删除的数据!");
                args.set_cancel(true);
                return;
            } else {
                if (confirm("是否确认删除信息")) {
                    $("#IDInfo").val(temp.substring(0, temp.length - 1));
                    args.set_cancel(false);
                } else {
                    args.set_cancel(true);
                    return;
                }
            }2
        }
        function btnUpClick(sender, args) {
            temp = "";
            $("input[name='ChecInfo']").each(function () {
                if (this.checked)
                    temp += $(this).val() + "^";
            });
            if (temp == "") {
                alert("请选择要审核的数据!");
                return false;
            } else {
                temp = temp.substring(0, temp.length - 1);
                var s = temp.split("^");
                if (s.length > 1) {
                    alert("只能选中一条数据");
                    temp = "";
                    args.set_cancel(true);
                    return;
                } else {
                    $("#IDInfo").val(temp);
                    args.set_cancel(false);
                }
            }
        }
        $("#AllCheck").click(function () {
            $("input[name='ChecInfo']").attr("checked", $(this).attr("checked"));
        });

        function SetValue() {

            temp = "";
            $("input[name='ChecInfo']").each(function () {
                if ($(this).attr("checked") && $(this).css("display") != "none")
                    temp += $(this).val() + "^";
            });
            if (temp == "") {
                alert("请选择要操作的数据!");
                k = false;
            } else {
                temp = temp.substring(0, temp.length - 1);
                var s = temp.split("^");
                if (s.length > 1) {
                    alert("请正确选择数据");
                    temp = "";
                    k = false;
                } else {
                    $("#IDInfo").val(temp);
                    k = true;
                }
            }
        }

      弹出一个窗体(页)修改

        $("#btnUpdate").click(function () {
            SetValue();
            if (k) {
                indexDepar("ApplyAuthorizedPage_Update.aspx?id=" + temp, '550px', '220px', "修改编制信息");
            }
        });
    </script>

  弹出一个窗体(页)新增

    <script type="text/javascript">
        $("#btnAdd").click(function () {
            indexDepar('ApplyAuthorizedPage_Add.aspx', '550px', '220px', '增加编制信息');
        });

    </script>

</body>

 

 

CS代码

 相关分页代码

  protected void Grid_ApplyAuthorized_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)

        {
            GetApplyAuthorized();
        }
        protected void Grid_ApplyAuthorized_PageIndexChanged(object sender, GridPageChangedEventArgs e)
        {
            GetApplyAuthorized();
        }
        protected void Grid_ApplyAuthorized_PageSizeChanged(object sender, GridPageSizeChangedEventArgs e)
        {
            GetApplyAuthorized();
        }

   /// <summary>

        /// 删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnDetele_Click(object sender, EventArgs e)
        {
            try
            {
                if (!string.IsNullOrEmpty(this.IDInfo.Value))
                {
                    string[] IDs = this.IDInfo.Value.Split(new char[] { '^' });
                    for (int i = 0; i < IDs.Length; i++)
                    {
                        applyAuthorizedBLL.DeleteApplyAuthorizedByid(int.Parse(IDs[i]));
                    }
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "focus", "alert('删除成功!');", true);
                    Grid_ApplyAuthorized.DataSource = applyAuthorizedBLL.GetApplyAuthorizedAll();
                    Grid_ApplyAuthorized.DataBind();
                }
            }
            catch (Exception)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "focus", "alert('删除失败!');", true);

            }

        }

  /// <summary>

        /// 审核
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnUp_Click(object sender, EventArgs e)
        {
            //GridDataItem[] li_selected = Grid_ApplyAuthorized.MasterTableView.GetSelectedItems();
            //int[] Id = li_selected.Select(gdItem => int.Parse(gdItem["Id"].Text)).ToArray();
            try
            {
                if (!string.IsNullOrEmpty(this.IDInfo.Value))
                {
                    string[] IDs = this.IDInfo.Value.Split(new char[] { '^' });
                    ApplyAuthorized amodel = new ApplyAuthorized();
                    SysUser user = this.SysUser;
                    for (int i = 0; i < IDs.Length; i++)
                    {
                        //更新ApplyUpAuthorized状态
                        amodel = applyAuthorizedBLL.GetApplyAuthorizedByid(Convert.ToInt32(IDs[i]));
                        amodel.ChangeDate = amodel.ChangeDate;
                        amodel.ChangeReason = amodel.ChangeReason;
                        amodel.CheckStatus = 1;
                        amodel.CheckDate = DateTime.Now;
                        amodel.CheckUser = user.RealName;
                        amodel.CreateDate = amodel.CreateDate;
                        amodel.Fk_Authorized_New = amodel.Fk_Authorized_New;
                        amodel.Fk_Authorized_Old = amodel.Fk_Authorized_Old;
                        amodel.Fk_SysUser_Id = user.Id;
                        amodel.Fk_Personnel_Id = amodel.Fk_Personnel_Id;
                        amodel.Fk_Unist_Id = amodel.Fk_Unist_Id;
                    }

                    applyAuthorizedBLL.UpdateApplyAuthorized(amodel);

                    ScriptManager.RegisterStartupScript(this, this.GetType(), "focus", "alert('审核成功!');", true);
                    Grid_ApplyAuthorized.DataSource = applyAuthorizedBLL.GetApplyAuthorizedAll();
                    Grid_ApplyAuthorized.DataBind();
                }
            }
            catch (Exception)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "focus", "alert(审核失败!');", true);
            }

        }

转载于:https://www.cnblogs.com/Fancy121219/archive/2012/09/03/2669232.html

你可能感兴趣的文章
Shuffle过程详解
查看>>
Amazon DynamoDB
查看>>
云数据库与其他数据库的关系
查看>>
Amazon AWS
查看>>
Amazon AWS EC2存储
查看>>
Amazon S3和EBS的区别
查看>>
AWS云管理平台
查看>>
NoSQL SimpleDB
查看>>
连接RDS数据库
查看>>
操作RDS数据库
查看>>
分布式并行编程
查看>>
swoolefy PHP的异步、并行、高性能网络通信引擎内置了Http/WebSocket服务器端/客户端...
查看>>
Python学习笔记
查看>>
unshift()与shift()
查看>>
使用 NPOI 、aspose实现execl模板公式计算
查看>>
行为型模式:中介者模式
查看>>
How to Notify Command to evaluate in mvvmlight
查看>>
STL容器内数据删除
查看>>
33. Search in Rotated Sorted Array
查看>>
461. Hamming Distance
查看>>