扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:中国IT实验室 来源:中国IT实验室 2007年10月1日
关键字:
在本页阅读全文(共2页)
#region web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
private void InitializeComponent()
{
this.BOk.Click += new System.EventHandler(this.BOk_Click);//这一行很重要
}
#endregion
protected void BOk_Click(object sender, EventArgs e)
{
// this._SearchTxt = this.search_txt.Text;
//this._SearchLX = this.search_lx.SelectedItem.Value;
if (BOkClick != null)
BOkClick(this, e);
}
private void showxwxx()//新闻管理模式的界面处理
{
Label1.Visible = false;
search_txt.Visible = true;
search_lx.Visible = true;
search_lx.Items.Clear();
ListItem myitem = new ListItem();
myitem.Text = "标题";
myitem.Value = "1";
search_lx.Items.Add(myitem);
myitem = new ListItem();
myitem.Text = "作者";
myitem.Value = "2";
search_lx.Items.Add(myitem);
search_lx.SelectedIndex = 0;
}
private void showuser()//操作员模式的界面处理
{
Label1.Visible = false;
search_txt.Visible = true;
search_lx.Visible = true;
search_lx.Items.Clear();
ListItem myitem = new ListItem();
myitem.Text="用户ID";
myitem.Value="1";
search_lx.Items.Add(myitem);
myitem = new ListItem();
myitem.Text = "用户名称";
myitem.Value = "2";
search_lx.Items.Add(myitem);
search_lx.SelectedIndex = 0;
}
private void showmin()//缺省模式的界面处理
{
Label1.Visible = true;
search_txt.Visible = true;
search_lx.Visible = false;
search_lx.Items.Clear();
}
}
}
/*用户控件代码结束*/
/*测试页界面开始*/
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="SearchBarTest.aspx.cs" Inherits="Control_SearchBarTest" %>
<%@ Register Src="SearchBar.ascx" TagName="SearchBar" TagPrefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
<link href="../CSS/system.css" _fcksavedurl=""../CSS/system.css"" _fcksavedurl=""../CSS/system.css"" _fcksavedurl=""../CSS/system.css"" rel="stylesheet" type="text/css" />
<link href="../CSS/searchbar.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<div>
<uc1:SearchBar ID="SearchBar1" runat="server" BarType="usertype" />
<asp:Label ID="Label1" runat="server" Text="查询结果"></asp:Label><br />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="缺省" />
<asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="操作员界面" />
<asp:Button ID="Button3" runat="server" OnClick="Button3_Click" Text="新闻管理界面" />
<asp:Button ID="Button4" runat="server" OnClick="Button4_Click" Text="隐藏下拉框" /></div>
<br />
</form>
</body>
</html>
/*测试页界面结束*/
/*测试页代码开始*/
using System;
using System.Data;
using System.Configuration;
using System.Collections;
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;
using MY.UC;
public partial class Control_SearchBarTest : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
#region web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
private void InitializeComponent()
{
//注册查询条的按钮事件
this.SearchBar1.BOkClick += new BOkClickHandler(this.SearchBar1_BOkClick);
}
#endregion
protected void SearchBar1_BOkClick(object sender, EventArgs e)
{
//查询按钮事件
Label1.Text = "查询内容:"+this.SearchBar1.SearchTxt +" 选择列表:"+ this.SearchBar1.SearchLX;
}
protected void Button1_Click(object sender, EventArgs e)
{
this.SearchBar1.BarType = EBarType.mintype;
}
protected void Button2_Click(object sender, EventArgs e)
{
this.SearchBar1.BarType = EBarType.usertype;
}
protected void Button3_Click(object sender, EventArgs e)
{
this.SearchBar1.BarType = EBarType.xwxxtype;
}
protected void Button4_Click(object sender, EventArgs e)
{
this.SearchBar1.LXVisible = false;
}
}
/*测试页代码结束*/
如需转载请注明出处:http://blog.csdn.net/stbrine
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者