如何使datagrid某一行变色,并发出15秒声音?

wxdxy 2003-08-22 01:42:57
ASP.NET中如何使datagrid某一行变色,并发出15秒声音,而双击该行则立刻停止声音?请哥哥姐姐帮忙!!
...全文
63 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
guoyan19811021 2003-08-22
  • 打赏
  • 举报
回复
dim i as integer
dim count as integer =datagrid.items.count
for i=0 to count-1
datagrid.items(i).Attributes.Add("onMouseOver","Currentcolor=this.style.backgroundcolor;" "this.style.backgroundColor='Gray';")
datagrid.items(i).Attributes.Add("onMouseOut","this.style.backgroundColor=Currentcolor;")
next
wxdxy 2003-08-22
  • 打赏
  • 举报
回复
谢谢大家,顺便请问Application中怎么加载类?可以直接<object class="xx">吗?
goody9807 2003-08-22
  • 打赏
  • 举报
回复
WebForm4.aspx.cs

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 chat
{
public class WebForm4 : System.Web.UI.Page
{
protected System.Data.SqlClient.SqlCommand sqlSelectCommand1;
protected System.Data.SqlClient.SqlCommand sqlInsertCommand1;
protected System.Data.SqlClient.SqlCommand sqlUpdateCommand1;
protected System.Data.SqlClient.SqlCommand sqlDeleteCommand1;
protected System.Data.SqlClient.SqlConnection sqlConnection1;
protected System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1;
protected System.Web.UI.WebControls.Label Label1;
protected DataGridPro.jjstarDataGrid JjstarDataGrid2;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.Label Label3;
protected System.Web.UI.WebControls.Label Label4;
protected System.Web.UI.WebControls.Label Label5;
protected DataGridPro.jjstarDataGrid JjstarDataGrid1;

private void Page_Load(object sender, System.EventArgs e)
{
if(false==this.IsPostBack)
{
DataSet ds=new DataSet();
this.sqlDataAdapter1.Fill(ds);
this.JjstarDataGrid1.DataSource=ds;
this.JjstarDataGrid1.DataBind();
JjstarDataGrid2.DataSource=ds;
JjstarDataGrid2.DataBind();
}
}
private void doScroll2(object sender,System.EventArgs e)
{
if(this.JjstarDataGrid1.CurrentPageIndex+1<this.JjstarDataGrid1.PageCount)
{
this.JjstarDataGrid1.CurrentPageIndex++;
DataSet ds=new DataSet();
sqlDataAdapter1.Fill(ds);
this.JjstarDataGrid1.DataSource=ds;
this.JjstarDataGrid1.DataBind();
}

}
private void doScrollTop(object sender,System.EventArgs e)
{
if(this.JjstarDataGrid1.CurrentPageIndex>0)
{
this.JjstarDataGrid1.CurrentPageIndex--;
DataSet ds=new DataSet();
sqlDataAdapter1.Fill(ds);
this.JjstarDataGrid1.DataSource=ds;
this.JjstarDataGrid1.DataBind();
}
}
private void click(object sender,System.Web.UI.WebControls.DataGridItemEventArgs e)
{
this.Label1.Text="单击第"+(e.Item.ItemIndex+1)+"行";
}
private void dblclick(object sender,System.Web.UI.WebControls.DataGridItemEventArgs e)
{
this.Label1.Text="双击第"+(e.Item.ItemIndex+1)+"行";
}
goody9807 2003-08-22
  • 打赏
  • 举报
回复
11.Datagrid 双击行,单击行事件
a.datagrid 双击行,单击行事件 如何做?
b.datagrid 中鼠标移动过后 行变色?
http://aspalliance.com/Colt/Articles/Article3.aspx

1.可以隐藏一个buttoncolumn,然后绑定客户端onclick事件激发该行的隐藏按钮的服务器段click事件;
2.在ItemDataBound事 件中

c#

if(e.Item.ItemType==ListItemType.Item || e.Item.ItemType==ListItemType.AlternatingItem)
{
e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor='#99cc00';this.style.color='buttontext';this.style.cursor='default';");
e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='';this.style.color='';");
}


vb.net

If e.Item.ItemType <> ListItemType.Header And e.Item.ItemType <> ListItemType.Footer Then
Response.Write(Color.Beige.ToString())
e.Item.Attributes("id") = e.Item.ItemType.ToString() + e.Item.ItemIndex.ToString()
e.Item.Attributes.Add("OnMouseOut", "this.style.backgroundColor='';")
e.Item.Attributes.Add("OnMouseOver", "this.style.backgroundColor='#99cc00';this.style.color='buttontext';this.style.cursor='default';")

End If
ga3ga3 2003-08-22
  • 打赏
  • 举报
回复
双击??这个不可能吧。单击还可以的。双基不知道是否用JAVASCRIPT来实现
leal 2003-08-22
  • 打赏
  • 举报
回复
发出声音在vb.net试试:
Dim I As Integer
For I = 1 To 100
Beep
Next I
leal 2003-08-22
  • 打赏
  • 举报
回复
例如; e.Item.BackColor = Color.SeaShell
leal 2003-08-22
  • 打赏
  • 举报
回复
例如; e.Item.BackColor = Color.SeaShell



sualtring 2003-08-22
  • 打赏
  • 举报
回复
不明白你要干什么 ?>?
qiuji 2003-08-22
  • 打赏
  • 举报
回复
“某一行变色”是指什么?

62,046

社区成员

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

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

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

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