Monday, August 8, 2011

Timeout Elapsed

We Got a issue for one of our application which has webparts on MOSS. This webpart has a search control and search results are displayed in Grid.

When search is performed then no results are displayed and we are getting
"Timeout expired. The timeout period elapsed prior to completion ofthe operation or the server is not responding."
After investigating we found our Table adpater is failing so to fix we wrote a small utility/added property  within the Tableadpater partial class.
And assigned commandTimeout property to the table adapter when before making call to DB.

Please find below code
namespace xxxTableAdapters

public partial class yyyTableAdapter


public int CommandTimeout {

set {

int i = 0;

while ((i < this.CommandCollection.Length)) {

if ((this.CommandCollection(i) != null)) {

this.CommandCollection(i).CommandTimeout = value;
i = (i + 1);



Assign property
public static DataTable GetSearchListt(int year, int month,string companyGroup)
DataTable result = null;
using (MyDataTableAdapters.DataTableAdapter tableAdapter = new MyDataTableAdapters.DataTableAdapter())
tableAdapter.CommandTimeout = 4000;
result = tableAdapter.GetData(year, month,Group);
return result

Let me know if it helped any one
Cheers :)

Thursday, July 28, 2011

How great leaders inspire action

Today i would like to share something real different on my blog which is great one to know.
That is How great leaders inspire action.

Watch this video , hope it inspires you in ahcieving your lifes best milestones .

Sunday, May 15, 2011

MVC3 Razor View Engine

People who are facinated using MVC2 here is some thing interesting feature i would like to share "Razor Engine" in MVC3.
ASP.NET MVC 3 ships with a new view-engine option called “Razor” (in addition to continuing to support/enhance the existing .aspx view engine.

Reason for Raqzor Engine in MVC3.
ASP.NET MVC always supported the concept of “view engines” – which are the pluggable modules that implement different template syntax options. The “default” view engine for ASP.NET MVC today uses the same .aspx/.ascx/.master file templates as ASP.NET Web Forms. Other popular ASP.NET MVC view engines used today include Spark and NHaml.

You can have Razor view engine in drop view engine dropdown when you create a view in mvc3.

You denote the start of a code block with Razor using a @ character. Unlike code nuggets, Razor does not require you to explicitly close the code-block:

Layout.cshtml” layout-page that will define the common layout UI we want across our site. The “RenderBody()” method indicates where view templates that are based on this master layout file should “fill in” the body content:

Master pages are a part of the ASPX WebForms view engine, not the MVC framework so Razor cannot interoperate with it.

For more details visite ScottGu's Blog :

Tuesday, April 26, 2011

Implementing BING Maps Ajax control in

I implemented BING maps Ajax control 6.3 for our corporate web site, and i would like to share here on my blog.

Basic thing here is i have used ajax control to give good user experience where zoom-In and zoom-Out are very easy with no server post backs.

I implemented Bing maps using Location data  we have in our DB including Latitude and Longittude values, using which i  placed cluster points on Bing Maps.

Below are breif steps, need anything more i can help
To use Bing maps ajax control place the below script tag in ASPpage or if you have master page the place in it.

1.First retreive Data from DB it should have latitude and longitude Data so that we point exact locations on Map.
To user bing maps ajax control place this script tag src in your aspx page html or master page

2.Pass Latitude and longidtude as Arrays to the Javascript function as i did in below, use this code in your code behind file in a method.StringBuilder sb = new StringBuilder("var lats = new Array(); var longs = new Array();var LocNames = new Array(); var Address = new Array();");

sb.AppendLine();for (int i = 0; i < dtArrayLocations.Rows.Count; i++)
if ((dtArrayLocations.Rows[i]["Latitude"] != System.DBNull.Value) && (dtArrayLocations.Rows[i]["Longitude"] != System.DBNull.Value))
sb.AppendFormat("lats[{0}]={1};longs[{0}]={2};LocNames[{0}]='{3}';Address[{0}]='{4}';", i, dtArrayLocations.Rows[i]["Latitude"], dtArrayLocations.Rows[i]["Longitude"], dtArrayLocations.Rows[i]["LOCATION_DESCRIPTOR"].ToString(), dtArrayLocations.Rows[i]["ADDRESS"].ToString().Replace("\n", "") + "," + dtArrayLocations.Rows[i]["CITY"].ToString().Trim() + "," + dtArrayLocations.Rows[i]["STATE_CODE"].ToString().Trim() + "," + dtArrayLocations.Rows[i]["ZIP"].ToString().Trim() + "
" + FormatPhoneNumbers(dtArrayLocations.Rows[i]["PHONE1"].ToString().Trim()) + "
" + dtArrayLocations.Rows[i]["FAX"].ToString());

ScriptManager.RegisterStartupScript(this, this.GetType(), "PointArrays", sb.ToString(), true);
Page.Form.Attributes.Add("onload", "LoadPushPins();");

3. Within Javscript LoadMap using the aobe latitude,longitude values. as below
  myMap = new VEMap('mapDiv');
function LoadPushPins() {
if (lats != null) {
for (var i = 0; i < lats.length; i++) {
var pp = new VEShape(VEShapeType.Pushpin, new VELatLong(lats[i], longs[i]));
myMap.SetCenterAndZoom(new VELatLong(lats[i], longs[i]), 13);
// Create a pin at that location
var desc = "");
function Cluster() {

The idea of sharing this is to give basic idea to implement BING Maps with DB i had tough times in exploring this. If you need any more details leave comment i can get back to you.

Enjoy :)

Monday, December 6, 2010

AjaxControlToolKit-Tab Panel

These days i got a chance to work on real cool stuff using AJAX control Toolkit, i used Tab Panel,CollapsiblePanelExtender and also Bing Maps AJAX Control, Version6.3. .

You will be seeing some more stuff on my blog in comming weeks on these controls, for now i would like to share something about TabPanel.

Below code will display list of data in one tab and Map on other Tab, based on search performed in previous page.

For this i used Design time to work with Tabcontainer and 2 Tab panels, check the below sample, if you need any more details leave a comment
<asp:toolkitscriptmanager id="ToolkitScriptManager1" runat="server" enablepagemethods="true">
<asp:tabcontainer id="TabContainer1" runat="server" activetabindex="1" cssclass="ajax__tab_xp"
autopostback="true" onactivetabchanged="TabContainer1_ActiveTabChanged" width="100%"
<asp:TabPanel runat="server" HeaderText="List View" ID="tbpanleList" TabIndex="0">
List View
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="False">
<!--Display the results here using Grid/Table-->
<!--- Place any events for implementing callback using update panle defined above , this update panel will be for this Tab Panel--->
<asp:TabPanel ID="tbpanleMapView" HeaderText="Map View" runat="server" TabIndex="1">
Map View
<div style="position: relative; width: 700px; height: 450px;" id="mapDiv" " />
<br />


Friday, September 3, 2010

Parse XML and store to DataTable

Parse the xml results and store data to Datatable.Below a Method will Display Data in Lables using result DataTable when URL is passed.

public void DisplaySearchResults(string URL)
XmlDocument myXMLDocument = null;
DataRow drDetails;
string ID;
string Title;
string Desc;
Label lblErrorMessage= new Label();

DataTable dtSearchResults = new DataTable();
myXMLDocument = new XmlDocument();
XmlNodeList objNodeList = myXMLDocument.SelectNodes("Root/Child1/);
DataColumn dcID = new DataColumn("ID", typeof(string));
DataColumn dcTitle = new DataColumn("Title", typeof(string));
DataColumn dcDesc= new DataColumn("Description", typeof(string));
foreach (XmlNode hitNode in objNodeList)

drDetails = dtSearchResults.NewRow();
ID = hitNode.SelectSingleNode("FIELD[@NAME='id']").InnerText;
drDetails["ID"] = ID;

Title = hitNode.SelectSingleNode("FIELD[@NAME='title']").InnerText;
drDetails["Title"] = Title;

Desc = hitNode.SelectSingleNode("FIELD[@NAME='desc']").InnerText;
drDetails["Description"] = Desc;



TableRow row;
TableCell cell1;
TableRow rowbody;
TableCell cell2;
Label lblTitle;
Label lblbodytext;

lblErrorMessage.Text = "";
if (dtSearchResults.Rows.Count > 0)
for (int i = 0; i < dtSearchResults.Rows.Count; i++)
row = new TableRow();
rowbody = new TableRow();
cell1 = new TableCell();
cell2 = new TableCell();

lblTitle = new Label();

lblTitle.Text = dtSearchResults.Rows[i]["Title"].ToString();
lblbodytext = new Label();
lblbodytext.Text = dtSearchResults.Rows[i]["Description"].ToString();


lblErrorMessage.Text = "No search results were found. Please try again";


Define a asp table in your ASPX page like below

This is basic solution, you can also do paging of xml result set like Google or Bing.

If this solution helped anyone Please leave a comment.

Enjoy Coding :)

Tuesday, August 10, 2010

SharePoint Server 2007 vs. 2010 Feature Comparison Matrix

Microsoft SharePoint Server 2010- You may have noticed that the 'Office' part of the name has dropped out. The reason being is that the “Office” brand will no longer include Server side components (such as SharePoint).

To know more about sharepoint 2010 check the below article that gives a comparison matrix between MOSS2007 and Sharepoint 2010.

Have fun