Hi,
This is Updated Solution for displaying popup on client click
<asp:treeview id="TreeView1" runat="server" xmlns:asp="#unknown">
<nodes>
<asp:treenode text="TextBox">
</asp:treenode>
<asp:treenode text="DropdownList"></asp:treenode>
<asp:treenode text="Button"></asp:treenode>
</nodes>
</asp:treeview>
<div id="showControlDetails1" style=" background-color:#136012; position:fixed;left:500px;top:600px; border-color:Red;">
dsfsdfsdfsdf
</div>
After that you need to add javascript file
$(document).ready(function () {
jQuery.fn.elementlocation = function () {
var curleft = 0;
var curtop = 0;
var obj = this;
do {
curleft += obj.attr('offsetLeft');
curtop += obj.attr('offsetTop');
obj = obj.offsetParent();
} while (obj.attr('tagName') != 'BODY');
return ({ x: curleft, y: curtop });
};
$("#TreeView1 a").each(function () {
$(this).click(function (eventObj) {
var location = $(this).elementlocation();
var x = eventObj.pageX - location.x;
var y = eventObj.pageY - location.y;
$.get("default8.aspx", { methodtype: "getProperties", controlname: $(this).text() }, function (data) {
$("#showControlDetails1").html(data);
$("#showControlDetails1").css('left', x);
$("#showControlDetails1").css('top', y);
$("#showControlDetails1").show();
});
return false;
});
});
$("#showControlDetails1").mouseleave(function () {
$("#showControlDetails1").hide();
});
});
Here you need to change
default8.aspx to your page name
And code behind file needs following code
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Request.QueryString["methodtype"] != null)
{
if (Request.QueryString["methodtype"].ToString() == "getProperties")
{
Response.Clear();
string cntname = Request.QueryString["controlname"].ToString();
Control txtchck = null;
string stresult = "";
switch (cntname)
{
case ("TextBox"):
txtchck = new TextBox();
break;
case ("DropdownList"):
txtchck = new DropDownList();
break;
case ("Button"):
txtchck = new Button();
break;
}
if (txtchck != null)
{
Type controlType = txtchck.GetType();
PropertyInfo[] properties = controlType.GetProperties();
foreach (PropertyInfo controlProperty in properties)
{
stresult = stresult + controlProperty.Name+"<br />";
}
}
Response.Write(stresult);
Response.End();
}
}
}
}
I hope you know how to add Jquery reference to page
All the Best