先看下面一段代码,实现的功能是截取下拉框value的值,然后现在要实现的是ToolTip的属性值问题。如果加再循环中,只能读出读后一个值,有什么事件可以实现吗??
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
 {
    strText = ds.Tables[0].Rows[i]["Task_Content"].ToString().Trim();
    strText = BWWL.OA.Common.Judge.StringTrunCate(strText, 15, "...");//截取任务内容
    ddlTask_ID.Items.Add(new ListItem(strText, ds.Tables[0].Rows[i]["Task_Id"].ToString()));
 }

解决方案 »

  1.   

    用HtmlSelect控件很好实现啊。
     <option title="ToolTip"></option>
      

  2.   

    不是 数据我已经上进去了 也已经截取成功了!然后我要选中下拉框时 显示完成的数据,而不是显示所截取的数据,也就是ToolTip的属性。
      

  3.   

    所有ddlTask_ID的元素,共用同一个父级的toolTip属性的,所以在循环中只会显示最后一个
      

  4.   

     strText = BWWL.OA.Common.Judge.StringTrunCate(strText, 15, "...");//截取任务内容调试一下,看返回的值,是否是截取后的字符串.也许根本没截取成功呢.
      

  5.   

    DropDownList1.Items[i].Attributes.Add("ToolTip", DropDownList1.Items[i].Value);
      

  6.   

     for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    ListItem li = new ListItem();
                    li.Attributes.Add("title",ds.Tables[0].Rows[i]["Task_Content"].ToString().Trim());//提示
                    li.Text = BWWL.OA.Common.Judge.StringTrunCate(strText, 15, "...");//截取任务内容
                    li.Value=ds.Tables[0].Rows[i]["Task_Id"].ToString();
                    ddlTask_ID.Items.Add(li );
                }
      

  7.   

    给DropDownListe的AllowDataBoundApend属性设为true试下,这个属性记不清了
      

  8.   

    用自定义属性做吧!<option value="4" tip="我是熊猫">熊猫</option>用js读取tip然后自定层显示tip里面的信息!!