错哪了?在线!!!!

tiantian1980 2004-04-30 06:58:27
<% @ Page language="C#"%>
<script language="C#" runat="server">
public void ToRigtList(object sender,EventArgs e)
{
for(int i=0; i<lbox1.Items.Count;i++)
{
ListItem item=lbox1.Items[i];
if(item.Selected)
{
lbox2.Items.Add(item);
lbox1.Items.Remove(item);
}
}
}
public void ToLeftList(object sender,EventArgs e)
{
for(int i=0; i<lbox2.Items.Count;i++)
ListItem item=lbox2.Items[i];
if(item.Selected)
{
lbox1.Items.Add(item);
lbox2.Items.Remove(item);
}
}
</script>
<html>
<head>
<title><title>
</head>
<body>
<b>ListBox演示</b>
<hr>
<form runat="server">
<table>
<tr>
<td>
<b>ListBox容器1:</b><br>
<asp:ListBox id="lbox1" Rows=5 SelectionMode="Multiple" runat="server">
<asp:ListItem>天天</asp:ListItem>
<asp:ListItem>天健</asp:ListItem>
<asp:ListItem>皇帝</asp:ListItem>
<asp:ListItem>皇后</asp:ListItem>
<asp:ListItem>靖靖</asp:ListItem>
</asp:ListBox>
</td>
<td>
<asp:Button id="ToRight" Text="-->" OnClick="ToRightList" runat="server"/>
<asp:Button id="ToLeft" Text="<--" OnClick="ToLeftList" runat="server"/>
</td>
<td>
<b>ListBox容器2:</b><br>
<asp:ListBox id="lbox2" Rows=5 SelectionMode="Multiple" runat="server"/>
</td>
</form>
</body>
</html>


...全文
43 14 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
wangsaokui 2004-05-01
  • 打赏
  • 举报
回复
12点前给分我还可以在排行榜上涨涨!!谢谢!
wangsaokui 2004-05-01
  • 打赏
  • 举报
回复
晚了,兄弟!

前台就是你的页面,文件名后缀为aspx
后台就是你的代码,文件名后缀为aspx.vb或aspx.cs
tiantian1980 2004-05-01
  • 打赏
  • 举报
回复
哪位仁兄,解释下前台后台,不懂!
我一直就一下就运行出来!
回复人: wangsaokui(无间道II(前传)) 分一定给!就今12点前吧!
wangsaokui 2004-04-30
  • 打赏
  • 举报
回复
后台:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace WebApplication2
{
/// <summary>
/// Summary description for WebForm1.
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.ListBox lbox1;
protected System.Web.UI.WebControls.Button ToRight;
protected System.Web.UI.WebControls.Button ToLeft;
protected System.Web.UI.WebControls.ListBox lbox2;

private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.ToRight.Click += new System.EventHandler(this.ToRight_Click);
this.ToLeft.Click += new System.EventHandler(this.ToLeft_Click);
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion

private void ToRight_Click(object sender, System.EventArgs e)
{
for(int i=0; i<lbox1.Items.Count;i++)
{
ListItem item=lbox1.Items[i];
if(item.Selected)
{
lbox2.Items.Add(item.Text);
lbox1.Items.Remove(item);
}
}
}

private void ToLeft_Click(object sender, System.EventArgs e)
{
for(int i=0; i<lbox2.Items.Count;i++)
{
ListItem item=lbox2.Items[i];
if(item.Selected)
{
lbox1.Items.Add(item.Text);
lbox2.Items.Remove(item);
}
}
}
}
}
wangsaokui 2004-04-30
  • 打赏
  • 举报
回复
前台:
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="WebApplication2.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title></title>
</HEAD>
<body>
<b>ListBox演示</b>
<hr>
<form runat="server" ID="Form1">
<table>
<tr>
<td>
<b>ListBox容器1:</b><br>
<asp:ListBox id="lbox1" Rows="5" SelectionMode="Multiple" runat="server">
<asp:ListItem>天天</asp:ListItem>
<asp:ListItem>天健</asp:ListItem>
<asp:ListItem>皇帝</asp:ListItem>
<asp:ListItem>皇后</asp:ListItem>
<asp:ListItem>靖靖</asp:ListItem>
</asp:ListBox>
</td>
<td>
<asp:Button id="ToRight" Text="-->" runat="server" /><BR>
<asp:Button id="ToLeft" Text="<--" runat="server" />
</td>
<td>
<b>ListBox容器2:</b><br>
<asp:ListBox id="lbox2" Rows="5" SelectionMode="Multiple" runat="server" />
</td>
</tr>
</table>
</form>
</body>
</HTML>
hnahzx 2004-04-30
  • 打赏
  • 举报
回复
看到有天天天健皇帝皇后靖靖,觉得有趣.能不能冒昧的问一下,你做的什么系统?
wangsaokui 2004-04-30
  • 打赏
  • 举报
回复
你下面的/table没有,上面的/title写错了

private void ToRight_Click(object sender, System.EventArgs e)
{
for(int i=0; i<lbox1.Items.Count;i++)
{
ListItem item=lbox1.Items[i];
if(item.Selected)
{
lbox2.Items.Add(item.Text);
lbox1.Items.Remove(item);
}
}
}

private void ToLeft_Click(object sender, System.EventArgs e)
{
for(int i=0; i<lbox2.Items.Count;i++)
{
ListItem item=lbox2.Items[i];
if(item.Selected)
{
lbox1.Items.Add(item.Text);
lbox2.Items.Remove(item);
}
}
}
tiantian1980 2004-04-30
  • 打赏
  • 举报
回复
我改后的代码,运行是空白!怪!!!!!
<% @ Page language="C#"%>
<script language="C#" runat="server">
public void ToRightList(object sender,EventArgs e)
{
for (int i=0; i<lbox1.Items.Count; i++) {
if (lbox1.Items[i].Selected)
lbox2.Items.Add(lbox1.Items[i].Text);
lbox1.Items.Remove(lbox1.Items[i].Text);
}

}
public void ToLeftList(object sender,EventArgs e)
{
for (int i=0; i<lbox2.Items.Count; i++) {
if (lbox2.Items[i].Selected)
lbox1.Items.Add(lbox2.Items[i].Text);
lbox2.Items.Remove(lbox2.Items[i].Text);
}

}
</script>
<html>
<head>
<title><title>
</head>
<body>
<b>ListBox演示</b>
<hr>
<form runat="server">
<table>
<tr>
<td>
<b>ListBox容器1:</b><br>
<asp:ListBox id="lbox1" Rows=5 SelectionMode="Multiple" runat="server">
<asp:ListItem>天天</asp:ListItem>
<asp:ListItem>天健</asp:ListItem>
<asp:ListItem>皇帝</asp:ListItem>
<asp:ListItem>皇后</asp:ListItem>
<asp:ListItem>靖靖</asp:ListItem>
</asp:ListBox>
</td>
<td>
<asp:Button id="ToRight" Text="-->" OnClick="ToRightList" runat="server"/></br>
<asp:Button id="ToLeft" Text="<--" OnClick="ToLeftList" runat="server"/>
</td>
<td>
<b>ListBox容器2:</b><br>
<asp:ListBox id="lbox2" Rows=5 SelectionMode="Multiple" runat="server"/>
</td>
</form>
</body>
</html>

wangsaokui 2004-04-30
  • 打赏
  • 举报
回复
for(int i=0; i<lbox2.Items.Count;i++)
ListItem item=lbox2.Items[i];
if(item.Selected)
{
lbox1.Items.Add(item);
lbox2.Items.Remove(item);
}
==============>
for (int i=0; i<lbox2.Items.Count; i++) {
if (lbox2.Items[i].Selected)
lbox1.Items.Add(lbox2.Items[i].Text);
lbox2.Items.Remove(lbox2.Items[i].Text);
}

兄弟,你也太懒了点吧
tiantian1980 2004-04-30
  • 打赏
  • 举报
回复
高手哪去了????????????????????????
高手哪去了????????????????????????
wangsaokui 2004-04-30
  • 打赏
  • 举报
回复
参考

void Check_Clicked(Object sender, EventArgs e) {
Message.Text="Selected Item(s):" + "<br>" + "<br>";
for (int i=0; i<checkboxlist1.Items.Count; i++) {
if (checkboxlist1.Items[i].Selected)
Message.Text=Message.Text + checkboxlist1.Items[i].Text + "<br>";
}
}
tiantian1980 2004-04-30
  • 打赏
  • 举报
回复
Line 18: ListItem item=lbox2.Items[i];
tiantian1980 2004-04-30
  • 打赏
  • 举报
回复
Compiler Error Message: CS1023: Embedded statement cannot be a declaration or labeled statement

Source Error:Line 18
wangsaokui 2004-04-30
  • 打赏
  • 举报
回复
给个出错提示嘛
Hit Fm联播网 版本:1.4 大小:12 MB 语言:中文 适用固件:Android 2.3.3及以上 分享日期:2014-11-03 游戏题材:音乐 开发商:Olis Innovation Inc. 内容介绍 **热情PLAY,只想听音乐** 广播不只能听,还能用看的? Hit Fm联播网与Olis Innovation合作推出全台首创『现场直播』电台APP,带你亲临现场与大明星接触。有什么话想讲,马上留言让主持人跟来宾看到,还有拿不完的好康跟优惠!赶紧下载「Hit Fm联播网」APP,颠覆你对广播的印象! 【流行音乐一手掌握】 无论你身在何处,北部、中部、南部、宜兰四分台实时广播马上听,随时切换自己喜欢的频道,24小时联合放送。 【广播现场在线直播】 Hit Fm现在不只能听,还能用看的!不定时在线直播节目现场,不用排队也能一睹主持人与明星风采~ 【实况文大家一起聊】 想听什么歌?有什么话想讲?有话想告诉你的偶像?实时聊天室让你直接LIVE参与节目内容。 【好康优惠尽情放送】 免费电影票?偶像纪念品?各种好康优惠每天给你抽,听节目还能拿好礼,哪来这么好康? 【最爱节目开播提醒】 总是过时间忘记收听?收藏你喜欢的节目开播准时提醒! 【音乐排行新歌试听】 华语、西洋、日亚、金全球金榜四大排行让你掌握流行动向,抢先试听新歌。 【实时投票想听就放】 还在苦苦等待播放你想听的歌嘛?打开实时歌单票选你想听的歌,节目内容由你决定!

62,243

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧