June 6, 2016

Setup Selenium for .Net application

If you want to setup Selenium and want to get more information about it, visit below URL to get information about it.
http://www.seleniumhq.org/

Above Site provides all setup information about Selenium.
Once you download Selenium Standalone server, you have to start it.

To Start Selenium Standalone server use below command on command prompt.
You need to install Java latest version.

java –jar D:\Software\Selenium\selenium-server-standalone-2.53.0.jar.

February 11, 2016

StyleCop code review tool

StyleCop tool can analyze C# code and can provide you suggestions where you can improve your code on the basis of style and consistence rules. It can be integrated with visual studio so you can run it inside your project. If you want to write clean code you can go through this.

Download link

February 10, 2016

Server.MapPath in Class Library C#

If you are using “Server.MapPath”  in assembly project, it will show you compilation error in application.To get rid of this issue, use “System.Web.HttpContext.Current.Server.MapPath” instead of “Server.MapPath”. You have to reference System.Web in your project.

February 9, 2016

Multiple update panel and multiple update progress

Below code snippet shows how we can use multiple update progress in ASP.Net application.

<asp:UpdatePanel ID="uPnlAction" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div id="dvWaring" runat="server">
   
<p>Multiple update panel and multiple update progress.</p>
</div>
<asp:UpdateProgress ID="uprUpgradation" AssociatedUpdatePanelID="uPnlAction"
      
runat="server">
<ProgressTemplate>
  Please wait …
<img alt="" src="/../Images/Processing.gif" />
</ProgressTemplate>
</asp:UpdateProgress>
</ContentTemplate>
</asp:UpdatePanel>


<asp:UpdatePanel ID="upnlCase" runat="server"
      
UpdateMode="Conditional" ChildrenAsTriggers="true">
<ContentTemplate>
<p></p>
<ProgressTemplate>
Please wait ...
<img alt="" src="/../Images/Processing.gif" />
</ProgressTemplate>
</asp:UpdateProgress>
</ContentTemplate>
</asp:UpdatePanel>

February 8, 2016

UpdateProgress control message ends before completion of action

Sometimes it happens, UpdateProgress control’s message/image disappear before completion of action.To fix this issue just change “AsyncPostBackTimeout” value of “ScriptManager” control.

<asp:ScriptManager ID="smControl" runat="server" AsyncPostBackTimeout="Your Value">
</asp:ScriptManager>

In “AsyncPostBackTimeout” property, assign value for this property.

That’s it.
Enjoy Learning

February 7, 2016

Install update package programmatically in Sitecore

If you want to install update package in Sitecore, you just need to use “Sitecore.Update”
assembly for this activity.

bool hasPostAction;
string historyPath;

ILog log = LogManager.GetLogger("root"
);
           
XmlConfigurator.Configure((XmlElement)ConfigurationManager.GetSection("log4net"));
using (new SecurityDisabler
())
{
DiffInstaller installer = new DiffInstaller(UpgradeAction.Upgrade);
MetadataView view = UpdateHelper.LoadMetadata(path);
List<ContingencyEntry> entries = installer.InstallPackage(path,   Sitecore.Update.Utils.InstallMode.Install, log, out hasPostAction, out
historyPath);
installer.ExecutePostInstallationInstructions(path, historyPath, Sitecore.Update.Utils.
InstallMode.Install, view, log, ref entries);
}