好急的.net问题 我在DataGrid中读出了部门表中字段USERID,USERNAME,BUMEN中的数据,其中我想实现的是,当我把鼠标指到某个USERID号时,自动显示列出和某个USERID同部门的所职工名称,这个功能类似QQ的头像那样,当我把鼠标移到某个人的头像上就显示出他的昵称和号码?解决问题就马上结分!!!!!高分求!!高分求!!!。。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 不太明白,什么叫某个USERID同部门的所职工名称.是所有职工名称??还是这个ID对应的职工的名称?用a标签的title属性.像这样<a title='职工名称:<%# DataBinder.Eval(Container.DataItem,"USERNAME") %>'></a>这样,当鼠标移动到这个a标签包含的字段上,就会显示这个提示.如果是列出这个部门的所有职工,可以在T-SQL语句中,读出每个部门的所有职工名,一起放入DataSet. USERID -- 就是这个ID对应的职工的名称,我的意思是凡是和这个ID对应相同部门的职工都列出来,, 不错,楼上说得对,可以用超连接的Title来实现. 在查询是也查询出和USERID对应的字段.如USERWITH使用模板列:<asp:Label Runat="server" style="CURSOR: hand" ToolTip='<%# DataBinder.Eval(Container.DataItem,"USERWITH")%>'><%# DataBinder.Eval(Container.DataItem,"USERID")%></asp:Label> e.Item.Cells[0].Attributes.Add("title","同部门的人员名单"); 有些控件有个AlternateText属性!AlternateText = "aa";就会出现你要的效果!! 当DataGrid读出了所有数据,那还要多加载一次才能实现的吧,,,就是说把鼠标移到任何一个USERID时,就马上加载检索与该ID所对应的所有相同部门的职工的名称。然后才显示出来。。对吧 private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) { if(e.Item.ItemType==ListItemType.Item||e.Item.ItemType==ListItemType.AlternatingItem) { //this.title可以显示多个列 e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor='#AAAADD';this.style.cursor='hand';this.title='"+e.Item.Cells[1].Text+e.Item.Cells[2].Text+"'"); e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='white'"); } } 用ToolTip<asp:Label Runat="server" style="CURSOR: hand" ToolTip='<%# DataBinder.Eval(Container.DataItem,"USERWITH")%>'><%# DataBinder.Eval(Container.DataItem,"USERID")%></asp:Label> 你上面那位兄弟说的private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e){if(e.Item.ItemType==ListItemType.Item||e.Item.ItemType==ListItemType.AlternatingItem){//this.title可以显示多个列e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor='#AAAADD';this.style.cursor='hand';this.title='"+e.Item.Cells[1].Text+e.Item.Cells[2].Text+"'");e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='white'");}}这样作连接不行的 private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e){if(e.Item.ItemType==ListItemType.Item||e.Item.ItemType==ListItemType.AlternatingItem){//this.title可以显示多个列//e.Item.Cells[1].Text和e.Item.Cells[2].Text是隐藏列。e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor='#AAAADD';this.style.cursor='hand';this.title='类型:"+e.Item.Cells[1].Text+" 大小:"+e.Item.Cells[2].Text+"'");e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='white'");}} 用datagrid的relation属性,将两个表关联就行 这样如何在this.title='类型:"+e.Item.Cells[1].Text+" 大小:"+e.Item.Cells[2].Text+"'");里添加连接呢? 如何避免这种情况下界面刷新??(怒吼) 请问谁有aspx在vim上的语法文件 小妹问个关于ProgressBar控件的问题 问个HyperLink的 关于GridView的用法求救 在线等,谢谢各位大虾了!! 用NetTiers模板构建数据访问层的一个错误 请问如何oledbdataread一条一条的读数据呀! 用。net技术如何才能得到如QQ邮件那样的邮件列表形式??、、求教 请大家来看看 高难的简单问题!关于页面响应的返回,请教各位高手 ase ado.net 的两个动态库Sybase.Data.DseClient.Dll与Aseado.Dll如何找到? 有没有.net高手,有项目合作!
用a标签的title属性.像这样<a title='职工名称:<%# DataBinder.Eval(Container.DataItem,"USERNAME") %>'></a>这样,当鼠标移动到这个a标签包含的字段上,就会显示这个提示.如果是列出这个部门的所有职工,可以在T-SQL语句中,读出每个部门的所有职工名,一起放入DataSet.
使用模板列:
<asp:Label Runat="server" style="CURSOR: hand" ToolTip='<%# DataBinder.Eval(Container.DataItem,"USERWITH")%>'><%# DataBinder.Eval(Container.DataItem,"USERID")%>
</asp:Label>
AlternateText = "aa";
就会出现你要的效果!!
{
if(e.Item.ItemType==ListItemType.Item||e.Item.ItemType==ListItemType.AlternatingItem)
{
//this.title可以显示多个列
e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor='#AAAADD';this.style.cursor='hand';this.title='"+e.Item.Cells[1].Text+e.Item.Cells[2].Text+"'");
e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='white'");
}
}
</asp:Label>
private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if(e.Item.ItemType==ListItemType.Item||e.Item.ItemType==ListItemType.AlternatingItem)
{
//this.title可以显示多个列
e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor='#AAAADD';this.style.cursor='hand';this.title='"+e.Item.Cells[1].Text+e.Item.Cells[2].Text+"'");
e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='white'");}
}这样作连接不行的
{
if(e.Item.ItemType==ListItemType.Item||e.Item.ItemType==ListItemType.AlternatingItem)
{
//this.title可以显示多个列
//e.Item.Cells[1].Text和e.Item.Cells[2].Text是隐藏列。
e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor='#AAAADD';this.style.cursor='hand';this.title='类型:"+e.Item.Cells[1].Text+" 大小:"+e.Item.Cells[2].Text+"'");
e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='white'");}
}
this.title='类型:"+e.Item.Cells[1].Text+" 大小:"+e.Item.Cells[2].Text+"'");
里添加连接呢?