Calling a Parent Javascript Method from a Child Page

If we want to call a javascript method on parent page from a child page, we could use something like this-

<a onclick=’javascript:parent.ParentJavaScriptMethod()’ >Click To Do Some Parent Specific Action </a>

parent. and follow it up by any method name that you wish to use in parent page.

Hope this helps

Cheers!!!

Adding Tooltip to Dropdown List Items

Here is a way to add tool tips to items in dropdownlist.

//Assuming dropdownLis1 is already Bound.      
foreach (ListItem listItem in dropdownList1.Items)
{
listItem.Attributes.Add("title", “tooltip text”);
}



 



Hope this Helps



Cheers!!!

Windows Process Explorer

Here is a excellent tool that shows what process are open and the processes that have opened it.

Process Explorer From Technet

Hope this helps!!!

Cheers

SQL Server Select a random row from a table

There are lots of ways to select a random record or row from a database table. Here are some example SQL statements that don't require additional application logic, but each database server requires different SQL syntax.

 

SELECT TOP 1 column FROM table
ORDER BY NEWID()


 
Hope this helps
Cheers!!!

Executing SSIS Packages Through C#

If we want to execute SSIS package through c#, Microsoft provides us with an easy to use API.

Here is what we had to be done.

For getting a list of packages that are present on the server.

  • Add a reference to your project of Microsoft.SqlServer.Dts.Runtime.
  • To get a list of packages that are present on the server use this snippet -
Microsoft.SqlServer.Dts.Runtime.Application app = 
new
Microsoft.SqlServer.Dts.Runtime.Application();
string serverIp = “YourServerIP”;
PackageInfos pInfos =
app.GetPackageInfos("\\", serverIp, null, null);
foreach (PackageInfo packageInfo in pInfos)
{
if (packageInfo.Flags != DTSPackageInfoFlags.Folder)
cbPackages.Items.Add(packageInfo.Name);
}




  • the packageInfo.Flags checks whether the package we are getting is a Folder or a Package


  • For Executing the Packages -



string serverIp = "YourServerIp";
foreach (var packageName in cbPackages.Items)
{
Microsoft.SqlServer.Dts.Runtime.Application app =
new Microsoft.SqlServer.Dts.Runtime.Application();
Package package =
app.LoadFromSqlServer("\\" + packageName, serverIp, null, null, null);
DTSExecResult result = package.Execute();
MessageBox.Show(result.ToString());
}







Hope this Helps!!



Happy Programming!!!



Cheers!!!

RegEx for validating Money

The following regex can be used for validating money-

 

^(\d*(\,\d*)*|(\d+))(\.\d*)?$

Matches – 1,234.00,1234,1234.00

Cheers!=

Dynamic Linq Queries

I found these two excellent articles on how to write dynamic LINQ queries. Dynamic LINQ queries are generally used when we have a number of keywords to search the database for. A perfect example of this scenario would be Searching the database based on random number of fields with Or’s and And’s. These articles address them very well.

Here are the links -

Rock Thoughts - And's & Or's Together

C# 3.0 In a NutShell - Predicate Builder

Hope this Helps!

Happy Programming!!

Cheers!