$("#<%=TypeTreeView.ClientID%>").on(‘click’, function () { GetNode(); });
<SelectedNodeStyle HorizontalPadding="0px" VerticalPadding="0px" CssClass="XSSselectedNode" />
protected void TypeTreeView_SelectedNodeChanged(object sender, EventArgs e)
{
TreeView tv = (TreeView)sender;
TreeNode tn = tv.SelectedNode;
TreeNodeCollection tnc = null;
StringBuilder sbscripts = new StringBuilder();
string _cl_ID = tn.Value;
string _cl = tn.Text;
_cl = _cl.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries)[0];
string _script = "$('#" + NodeNameText.ClientID + "').val('" + _cl + "');" +
"$('#" + hidParentValue.ClientID + "').val('" + _cl + "');" +
"$('#" + hidNodeID.ClientID + "').val('" + _cl_ID + "');";
sbscripts.Append(_script);
if (tn.Parent == null)
{
chkType.Checked = true;
chkFlows.Checked = false;
sbscripts.Append("$('#" + chkType.ClientID + "').prop(\"checked\", true);");
sbscripts.Append("$('#" + chkFlows.ClientID + "').removeProp(\"checked\", false);");
}
else
{
//tnc = tn.Parent.ChildNodes;
chkType.Checked = false;
chkFlows.Checked = true;
sbscripts.Append("$('#" + chkFlows.ClientID + "').prop(\"checked\", true);");
sbscripts.Append("$('#" + chkType.ClientID + "').removeProp(\"checked\", false);");
}
ScriptManager.RegisterStartupScript(this, this.GetType(), "", sbscripts.ToString(), true);
}
function ClickNodeEvent() {
var elem;
if (event.target) {
elem = (event.target.nodeType == 3) ? event.target.parentNode : event.target;
}
else {
elem = event.srcElement;
}
//)来代替IE下的event.srcElement或者Firefox下的event.target
if (elem.innerText == undefined || elem.innerText.length <= 0 || elem.nameProp == undefined)
return true;
//var SelectedID = elem.id;
$(elem.id).parent().addClass("XSSselectedNode"); // 追加样式
//$(SelectedID).addClass("XSSselectedNode"); // 追加样式
var selectNodetv = GetNodeInfo(elem.id);
$("#<%=NodeNameText.ClientID%>").val(selectNodetv[0]);
$("#<%=hidParentValue.ClientID%>").val(selectNodetv[0]);
$("#<%=hidNodeID.ClientID%>").val(selectNodetv[1]);
$("#<%=lblID.ClientID%>").text(selectNodetv[1]);
//return false;
}
function editNode() {
//$.each(objs, function () {
//var textvalue = text + "|" + hrefvalue[0];
//select.push(textvalue);
//获取列的value
//var value = $(this).next().attr("href");
获取列的值
//var text = $(this).next().text();
Text和Value值
//var textvalue = text + "|" + value;
//select.push(textvalue);
//});
//alert(select.join("&"));
//window.returnValue = select.join("&");
//window.close();
}
function deleteNode() {
}