将工具提示设置为gridviewin.net中的链接按钮
我有一个链接按钮,它是我的gridview的模板字段。我需要在每行中设置不同的文本作为linkbutton的工具提示。我的代码不起作用将工具提示设置为gridviewin.net中的链接按钮,.net,gridview,rowdatabound,.net,Gridview,Rowdatabound,我有一个链接按钮,它是我的gridview的模板字段。我需要在每行中设置不同的文本作为linkbutton的工具提示。我的代码不起作用 protected void Grid_course_RowDataBound(object sender, GridViewRowEventArgs e) { connect con = new connect(date); if (e.Row.RowType == DataControlRowType.DataRow ) {
protected void Grid_course_RowDataBound(object sender, GridViewRowEventArgs e)
{
connect con = new connect(date);
if (e.Row.RowType == DataControlRowType.DataRow )
{
LinkButton l = (LinkButton)e.Row.Cells[0].FindControl("Course_Name");
IList<connect.Course> a = con.getCourse(l.Text);
var result = string.Join(",", a[0].Course_Description__c);
l.ToolTip = result.ToString();
}
}
protectedvoid Grid\u course\u RowDataBound(对象发送方,GridViewRowEventArgs e)
{
connect con=新连接(日期);
如果(e.Row.RowType==DataControlRowType.DataRow)
{
LinkButton l=(LinkButton)e.Row.Cells[0]。FindControl(“课程名称”);
IList a=con.getCourse(l.Text);
var result=string.Join(“,”,a[0]。课程描述(c);
l、 ToolTip=result.ToString();
}
}
它只适用于第一排 创建一个字典,其中链接按钮的文本作为索引,相应的工具提示文本作为值。使用RowDataBound()事件中的索引检索该值。将其设置为工具提示
protected void Grid_course_RowDataBound(object sender, GridViewRowEventArgs e)
{
connect con = new connect(date);
IList<connect.Courses> ob= con.getCoursedetails();
Dictionary<string, string> example = new Dictionary<string, string>();
for (int i = 0; i < ob.Count; i++)
example.Add(ob[i].Name.ToString(), ob[i].Course_Description__c.ToString());//Setting Values to dictionary
if (e.Row.RowType == DataControlRowType.DataRow )
{
LinkButton l = (LinkButton)e.Row.Cells[0].FindControl("Course_Name");
l.ToolTip = example[l.Text].ToString();//Retrieving values using index from dictiory.
}
}
protectedvoid Grid\u course\u RowDataBound(对象发送方,GridViewRowEventArgs e)
{
connect con=新连接(日期);
IList ob=con.getCoursedDetails();
字典示例=新字典();
for(int i=0;i
迭代时,结果包含什么?我从salesforce对象获取的数据基于gridview中的一个字段,该字段必须设置为工具提示。