In order to set control's colour pragmatically, I used following syntax in C#
btnSearch.ForeColor = Color.FromArgb(0x444444);
ASP.NET, C#.NET, CruiseControl.NET, Microsoft SQL Server, MS-DOS Batch, MySQL, nAnt, NodeJs, PowerShell, Python, Selenium RC, Redis, WebAii, Ubuntu
Thursday, March 27, 2014
Thursday, February 27, 2014
Check for string if it contains positive integer in C#
In order to check if strings is positive integer I used following check in C#
String maxRecords;
if (maxRecords == "" || !maxRecords.All(Char.IsDigit))
{
// Logic to implement when string contains no valid postive integer.
}
String maxRecords;
if (maxRecords == "" || !maxRecords.All(Char.IsDigit))
{
// Logic to implement when string contains no valid postive integer.
}
Monday, February 24, 2014
Wrap text for the particular column of GridView
In order to wrap particular column of GridView of ASP.NET I used following
protected void GridViewLog_RowDataBound(object sender, GridViewRowEventArgs e)
{
e.Row.Cells[7].Attributes.Add("style", "word-break:break-all;word-wrap:normal");
}
Here column 7 of the GridView gets text wrapped.
protected void GridViewLog_RowDataBound(object sender, GridViewRowEventArgs e)
{
e.Row.Cells[7].Attributes.Add("style", "word-break:break-all;word-wrap:normal");
}
Here column 7 of the GridView gets text wrapped.
Wednesday, February 12, 2014
Close Browser using C#
In Order to Kill (close) all Internet Explorer browser launched, I used following C# code
Process[] localByName = Process.GetProcessesByName("iexplore");
foreach (Process item in localByName)
{
try
{
item.Kill();
}
catch
{
}
}
Process[] localByName = Process.GetProcessesByName("iexplore");
foreach (Process item in localByName)
{
try
{
item.Kill();
}
catch
{
}
}
Tuesday, February 11, 2014
CruiseControl Scheduled Trigger
In order to schedule CruiseControl build at specific time every day, I used following trigger in the project block
<triggers>
<scheduleTrigger time="22:00" buildCondition="ForceBuild" />
</triggers>
<triggers>
<scheduleTrigger time="22:00" buildCondition="ForceBuild" />
</triggers>
Start and Stop IIS Website using PowerShell
In Order to stop and start website using PowerShell script I used following command
Import-Module WebAdministration
Stop-WebSite -Name 'Maintenance'
Start-Sleep -s 5
Start-WebSite -Name 'Maintenance'
Import-Module WebAdministration
Stop-WebSite -Name 'Maintenance'
Start-Sleep -s 5
Start-WebSite -Name 'Maintenance'
Wednesday, February 05, 2014
Show stack trace in NUnit report in CruiseControl Dashboard
In order to have stack train in CruiseControl NUnit webdashboard report, I have added <xsl:value-of select="./failure/stack-trace"/> in webdashboard\xsl\nunitv2.xsl file. Here is the snippet
<xsl:if test="@success != 'True' ">
<tr bgcolor="#FF9900"><td colspan="3"><xsl:value-of select="./failure/message"/><br></br><br></br><xsl:value-of select="./failure/stack-trace"/></td></tr>
</xsl:if>
<xsl:if test="@success != 'True' ">
<tr bgcolor="#FF9900"><td colspan="3"><xsl:value-of select="./failure/message"/><br></br><br></br><xsl:value-of select="./failure/stack-trace"/></td></tr>
</xsl:if>
Subscribe to:
Posts (Atom)