zoukankan      html  css  js  c++  java
  • net4:MultiView(view)行为中的commmandname与commmandargument,ListBox的使用及移动操作

    原文发布时间为:2008-07-29 —— 来源于本人的百度文章 [由搬家工具导入]

    using System;
    using System.Data;
    using System.Configuration;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;

    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

            MultiView1.ActiveViewIndex = 0;
            switch (ListBox1.SelectedValue)
            {
                case "nan":
                    Response.Write(ListBox1.SelectedValue);
                    break;
                case "nv":
                    Response.Write(ListBox1.SelectedValue);
                    break;
            }

        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            ListItem lt = new ListItem(ListBox1.SelectedItem.Text, ListBox1.SelectedItem.Value);
            if (ListBox1.SelectedIndex > 0)
            {
                ListBox1.Items[ListBox1.SelectedIndex].Text = ListBox1.Items[ListBox1.SelectedIndex - 1].Text;
                ListBox1.Items[ListBox1.SelectedIndex].Value = ListBox1.Items[ListBox1.SelectedIndex - 1].Value;
                ListBox1.Items[ListBox1.SelectedIndex - 1].Text = lt.Text;
                ListBox1.Items[ListBox1.SelectedIndex - 1].Value = lt.Value;
                ListBox1.SelectedIndex = ListBox1.SelectedIndex - 1;
            }
            else
            {
                Response.Write("<script>alert('到达第一条记录无法上移')</script>");
            }
        }
        protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            MultiView1.ActiveViewIndex = Convert.ToInt32( DropDownList1.SelectedValue)-1;
        }
    }

  • 相关阅读:
    LockFree的栈实现及与加锁实现的性能对比
    redis源码笔记-redis.conf
    【ASP.NET】应用程序、页面和控件的生命周期
    【ASP.NET】HTTP客户请求的数据格式说明
    【ASP.NET】页面间传值
    【ASP.NET】Page.IsPostBack 属性
    【ASP.NET】互联网HTTP连接等出错代码大全
    【经验分享】抽象类、虚函数、接口、多态 概念与关系的理解
    【架构设计】需求分析
    【经验分享】常用正则表达式收集
  • 原文地址:https://www.cnblogs.com/handboy/p/7141586.html
Copyright © 2011-2022 走看看