0

I want to Create dynamically, custom Tooltips like this or this from code Behind, this is what I 've got so far.

 public void printSubjects()
{
    SqlConnection con = new System.Data.SqlClient.SqlConnection();
    con.ConnectionString = ConfigurationManager.ConnectionStrings["beta"].ConnectionString;

    SqlDataAdapter da = new SqlDataAdapter("select SUBJECT_ID,X_COOR,Y_COOR from M_SUBJECT WHERE TERRITORY_ID =" + Convert.ToInt32(ddMaps.SelectedItem.Value) + " AND X_COOR !='" + 0 + "'", con);
    DataSet ds = new DataSet();
    da.Fill(ds, "SubjectLinked");
    points = new Button[ds.Tables[0].Rows.Count];

    for (int i = 0; i < ds.Tables[0].Rows.Count; i++ )
    {
        points[i] = new Button();
        points[i].CssClass = "fixPoint";
        points[i].Style.Add("top", ds.Tables[0].Rows[i]["Y_COOR"].ToString() + "px");
        points[i].Style.Add("left", ds.Tables[0].Rows[i]["X_COOR"].ToString() + "px");

        SqlDataAdapter daII = new SqlDataAdapter("select USER_NAME from I_SUBJECT WHERE ID =" + Convert.ToInt32(ds.Tables[0].Rows[i]["SUBJECT_ID"].ToString()) + "", con);
        DataSet dsII = new DataSet();
        daII.Fill(dsII, "SubjectName");

        points[i].ToolTip = dsII.Tables[0].Rows[0]["USER_NAME"].ToString();


        points[i].Click += new EventHandler(deleteLink_Click);

        myID.Controls.Add(points[i]);
    }

}

And this is the result enter image description here

How to implement jquery qtip or ajax hover menu or anything else in order to add Subject Image and Other Subject Info inside each Tooltip from Code behind..?

2 Answers 2

1

Finally I ended up using ASPNetToolTip. In the .cs file I made an HtmlTable with Subject's Title(Label) and Image(img) and then I passed it to the AspNetToolTip and that did the trick. I didn't bother with any Javascript or Html code, all the code was written in C#.

Sign up to request clarification or add additional context in comments.

Comments

0

you can create a custom control. When you override the Render method, you provide the Html Code you want to be written in the page.

Here is a sample: http://msdn.microsoft.com/en-us/library/aa310915(v=vs.71).aspx

And the full literature if you have time and will: http://msdn.microsoft.com/en-us/library/zt27tfhy(v=vs.100).aspx

Hope this helps

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.