先看下面一段代码,实现的功能是截取下拉框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()));
}
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()));
}
<option title="ToolTip"></option>
{
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 );
}