Monday, March 26

For making dynamic tabs I will use Ajax Tab Container controls. I will create tabs dynamically, will add controls to each of the tabs dynamically and after that we will read the value of each control on some button click.

Step 1: Open visual studio and create a web site.

STEP 2: Add the refrence to AjaxToolkit.

Now I Have Created One User control as AjaxTabUserControl.ascx as shown in below screenshot

For making dynamic tabs I will use Ajax Tab Container controls. I will create tabs dynamically, will add controls to each of the tabs dynamically and after that we will read the value of each control on some button click.

Step 1: Open visual studio and create a web site.

STEP 2: Add the refrence to AjaxToolkit.

STEP 3: Declare Globally TabContainer.

STEP 4: Next is we need to create tabs dynamically. We can write code for making Dynamic Tabs in Page_load event also but the problem of writing this code in Pageload event is: If we are creating dynamic tabs for a Sharepoint custom Webpart than it will throw error on postback events. But it will work for normal ASPX pages. For this reason I will write it in Page_Init function.

STEP 5: After creating dynamic tabs we will add dynamic controls to it. Here I will create one asp table and then add the controls to it and after adding controls I will add this dynamically generated table to the tabs of the Tab Container control.

The reason why I am adding a table is just for formatting. You can directly add controls to the panel.

STEP 6: Here I have added one button and created one click event on it. This button click event I will use for reading the dynamically generated controls

Here I used one placeholder PC1 also. If we are creating Dynamic tabs for ASP application than no problem but if we are building it for Sharepoint than it is very helpful. If we are not using it than sometimes postback triggers are showing some ajax javascript error.

Now press F5 and see the result.

Hope this article will be a help to you!

Thanks Shibashish mohanty

Thursday, March 15

Here i have described a simple console application for a beginners. First open Visual Studio.Now go to File--> New Project.It will Display a Form like Below and give the name of that application and clickOkButton

Now After create that Application Right click on That Project and Add-->New Item-->Class.csName it as you like.

Now i gave that class name asAddAbstractMethod.csThe view is like this

Now Add one Interface and name it asInterfaceAdd.csIt looks like as:

Now I have Added another Class Name it asAddImplementation.csIt looks like as:

Now Finally I wrote code insideProgram.csIt looks like as:

Now after Running this it will give result like this:

Inprogram.csi have called only Add Method similarly you can call other methods.

Now take one class library(goto solution-->right click and add new project and select class library) and name it as Framework.cs

Now it will display like this:-

Now within that library create two folder Like Log And SendMail Now inside Log Folder Add one class as Log.cs and inside SendMail Add another class as SendMail.cs

Now the Code Inside Log.cs is:-

using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Net.Mail;
using System.Globalization;
using System.Threading;
using System.Text.RegularExpressions;
using System.Web;
using System.Configuration;

using System;
using System.Net.Mail;
using System.Text;
using System.Data;
using System.Data.OleDb;
using System.Configuration;
namespace Framework
{
public class SendMail
{
#region Methods and Implementation
/// <summary>
/// Constructor
/// </summary>
/// <param name="strConnection">ConnectionString to use to save the mail in the database</param>
public SendMail()
{
}

Now take another class library(goto solution-->right click and add new project and select class library) and name it as BusinessObject

Now it will display like this:-

Now within that library create one class and name it as NtierTestTableObject.csand the code looks as:-Now the Code Inside NtierTestTableObject.cs is:-using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public string NGender
{
get { return _NGender; }
set { _NGender = value; }
}
}
}I have created the property regarding my tables in sqlserver database. I have declared the Operation variable regarding to my store procedure and other variable declared according to my columns in my Table.

Now take another class library(goto solution-->right click and add new project and select class library) and name it as DataAccessLayer

Now it will display like this:-

Now within that library create two folder Like Abstract And ADMIN And Create one class as NtierTestTableDAL.cs. Now inside Abstract Folder Add one class as AbstractData.cs and inside ADMIN Add another class as _ERPDataAccess_.cs

Now the Code Inside AbstractData.cs is:-using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Text;
using Framework;

// // We get the the previously created parameter from the command
// // and fill in the content with oContents argument
// oOledbLobs[i] = (OledbLob)blobCommands.Parameters[0].Value;
// oOledbLobs[i].BeginBatch(OledbLobOpenMode.ReadWrite);
// oOledbLobs[i].Write(oContents[i], 0, oContents[i].Length);
// // This operation is made under the same transaction than
// // the insert one (see oTransaction)
// oOledbLobs[i].EndBatch();
// oBlobParameters[i].Value = oOledbLobs[i];

}
return objBOList;
}
}
}Now take another class library(goto solution-->right click and add new project and select class library) and name it as CacheLayer

Now it will display like this:-

Now within that library create one class and name it as NtierTestTableCL.csand the code looks Like as:-Now the Code Inside NtierTestTableCL.cs is:-using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IntegrationLayer;
using BusinessObject;

Now the Code Behind Of NtierTest.aspx.cs is:-using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BusinessObject;
using BusinessAccessLayer;
using Framework;