HELO SIR.
i m using htmlgenericcontrl for ul and li for dynamic menu
in that for submenu i want to disply submenu name and img
and i want to give a link to submenu name and also for image
so pls help me
how to add a href link to image or to any div
thk u
How to add a href to htmlgenericcontrol img in asp.net c#
5 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Sunny SharmaRank #223 · 11.1K pointsPosted Sep 6, 2013, 4:28 AM EDT
Anyway, follow this code, this is how you should do it:
-------------------------------------------------
HtmlGenericControl li = new HtmlGenericControl("li"); HtmlGenericControl anchor = new HtmlGenericControl("a"); anchor.Attributes.Add("href", "http://www.google.com"); HtmlGenericControl img = new HtmlGenericControl("img"); img.Attributes.Add("height", "100px"); img.Attributes.Add("width", "100px"); img.Attributes.Add("src", "Images/info.png"); anchor.Controls.Add(img); li.Controls.Add(anchor); panel1.Controls.Add(li); ------------------------------------------------- Hope it helps! Happy Coding :)Sunny SharmaRank #223 · 11.1K pointsPosted Sep 6, 2013, 2:21 AM EDT
Just put that image inside anchor like:
Hope you got the point.
Happy Coding :)
rajashri sarade22 pointsPosted Sep 6, 2013, 3:15 AM EDT
Sunny SharmaRank #223 · 11.1K pointsPosted Sep 6, 2013, 3:18 AM EDT
rajashri sarade22 pointsPosted Sep 6, 2013, 3:28 AM EDT
1 short reply
suresh bairla2 pointsPosted Feb 19, 2015, 3:20 AM EST