Monday, 26 September 2011

how to disable the Selected tree Node in Asp.net pages or SharePoint 2010 Webpart



We should Not allow the user to click twice on the same node.because it cause post back

Solution:
 - -> Pass the root Node value as a parameter
// Method for Going all Nodes and setting the Enable and disable
    protected void ParseNode(TreeNode tnRootNode)
        {
            if (tnRootNode.Selected)
            {
                tnRootNode.SelectAction = TreeNodeSelectAction.None;
            }
            else
            {
                tnRootNode.SelectAction = TreeNodeSelectAction.Select;
            }
              
            foreach (TreeNode child in tnRootNode.ChildNodes)
            {
                if (child.ChildNodes.Count > 0)
                {
                    ParseNode(child);
                }
                else
                {

                    if (child.Selected)
                    {
                        child.SelectAction = TreeNodeSelectAction.None;
                    }
                    else
                    {
                        child.SelectAction = TreeNodeSelectAction.Select;
                    }
                }
            }
         
        }





Automation Server cant create An Object Error in SharePoint 2010




Problem:
 When try to validation in File upload control as regular expression it shows automation server cant create object Error.

solution:
In Internet Explorer, click on Tools -> Internet Options -> Security Tab and then under "Security level for this zone" click Custom Level... Locate the "ActiveX controls and plug-ins" section and then set "Initalize and script ActiveX controls not marked as safe for scripting" to "Prompt" which will force IE to prompt you for approval when an ActiveX control that is not marked as safe (such as WScript) attempts to be called.