Category ASP.NET

Read Multiple Files from folder and Download using FTP location in Console Application using C#

Category: ASP.NETC#.Net Comments: No comments

Today I’m going to tell you to read multiple files from folder using FTP Location.Please follow below steps to fetch Step 1 :- Place code in Class file string ftpDownloadResult = string.Empty; try { WebRequest request = WebRequest.Create(ConfigurationManager.AppSettings["FTPPath"]); request.Method = WebRequestMethods.Ftp.ListDirectory; request.Credentials = newNetworkCredential(ConfigurationManager.AppSettings["FTPUserName"], ConfigurationManager.AppSettings["FTPPassword"]); Read More

CasCading DropDownList using Generic Handler and JQuery in

Category: ASP.NETGENERIC HANDLERJQUERY Comments: 2 comments

ometimes we need to do fill dropdownlist using JQuery and Generic Handler in Explanation given below: Design Page: SELECT YOUR STATE Generic Handler: public void ProcessRequest(HttpContext context) { context.Response.ContentType = "application/json"; int id = Convert.ToInt32(context.Request["id"]); string sJSON = GetProduct(id); context.Response.Write(sJSON); } public string GetProduct(int id)Read More

CasCading DropDownList using Array in

Category: ASP.NETC#.Net Comments: No comments

Sometimes we need to do fill dropdownlist using Array(2 Dimensional and 3 Dimensional) For Static Value in Explanation given below: Design Page:
Code Page: protected void Page_Load(object sender, EventArgs e) { if(!IsPostBack)Read More

JQuery Validate RadioButtonList in Asp.Net Example

Category: ASP.NETJQUERY Comments: No comments

I will explain how to validate Radiobuttonlist using Jquery using Script For Validation Design Page :
Read More

Import Data from Excel and CSV to SQL server using C# in

Category: ASP.NETC#.Net Comments: 4 comments

The Page having a FileUpload control and the Upload button, on selecting the Excel or CSV file user needs to click on Upload button to store the data to Server. Here we are treating the uploaded file as database hence we need to create OLEDB connection to this file, from this connection will be created and the data is fetched to C# as DataTable. '[Sheet1$]' is the Name of the Worksheet where requires data is present. Table CREATE TABLE [dbo].[Tag]( [ID] [int] IDENTITY(1,1) NOT NULL, [TagType] [int] NULL, [TagCode] [nvarchar](100) NULL, [Status] [bit] NULL, [Duration] [int] NULL) Stored Procedure Create proc [dbo].[ExcelTag] @TagType int, @TagCode nvarchar(100), @Status bit, @Duration int as if Not exists(Select top 1 TagCode from dbo.[Tag] where TagCode=@TagCode) Begin insert into dbo.[Tag](TagType,TagCode,[Status],Duration)values(@TagType,@TagCode,@Status,@Duration) EndRead More

ASP.NET Page Life Cycle with Example

Category: ASP.NET Comments: One comment

PreInit : The entry point of the page life cycle is the pre-initialization phase called “PreInit”. You can dynamically set the values of master pages and themes in this event. You can also dynamically create controls in this event. Init : This event fires after each control has been initialized, each control's UniqueID is set and any skin settings have been applied. You can use this event to change initialization values for controls. The “Init” event is fired first for the most bottom control in the hierarchy, and then fired up the hierarchy until it is fired for the page itself. InitComplete: Raised once all initializations of the page and its controls have been completed. Till now the viewstate values are not yet loaded, hence you can use this event to make changes to view state that you want to make sure are persisted after the next postback PreLoad : Raised after the page loads view state for itself and all controls, and after it processes postback data that is included with the Request instance (1)Loads ViewState : ViewState data are loaded to controls (2)Loads Postback data : postback data are now handed to the page Load: The important thing to note about this event is the fact that by now, the page has been restored to its previous state in case of postbacks. Code inside the page load event typically checks for PostBack and then sets control properties appropriately. This method is typically used for most code, since this is the first place in the page lifecycle that all values are restored. Most code checks the value of IsPostBack to avoid unnecessarily resetting state. You may also wish to call Validate and check the value of IsValid in this method. You can also create dynamic controls in this method.Read More

Calling an stored procedure using ADO.NET Entity Model (Entity Framework LINQ to SQL)

Category: ASP.NETENTITY FRAMEWORKLINQ Comments: No comments

In this article I would like to share something regarding Entity Framework, how we can implement operations using Stored Procedures in Entity Framework. SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[Users]( [Uid] [int] IDENTITY(1,1) NOT NULL, [Fname] [nvarchar](50) NULL, [Lname] [nvarchar](50) NULL, [Email] [nvarchar](50) NULL, [Gender] [nvarchar](50) NULL, [Address] [nvarchar](50) NULL, CONSTRAINT [PK_Users] PRIMARY KEY CLUSTERED ( [Uid] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO SET ANSI_NULLS ON GO Read More

Regular Expression For Multiple Email Id in

Category: ASP.NET Comments: No comments

Sometimes we need to check multiple email id separated by comma using regular expression.
Solution is below:

<asp:TextBox ID=”txtEmailAddress”  runat=”server” ></asp:TextBox>

<asp:RegularExpressionValidator ID=”RegularExpressionValidator1″ runat=”server” ControlToValidate=”txtEmailAddress”
ErrorMessage=”Invalid email address.” ValidationExpression=”\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*([;]\s*\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*)*”
CssClass=”NormalRed” Display=”Dynamic”></asp:RegularExpressionValidator>

Read More

Check/Uncheck GridView Rows using a Checkbox in JQuery

Category: ASP.NETJQUERY Comments: No comments

I have a one gridview with checkboxes here my requirement is if I select header checkbox of gridview I need to select all the child checkboxes in gridview and if I deselect header checkbox I need to deselect all the child checkboxes in gridview and if I select all the child checkbox I need to select the header checkbox and if any child checkbox deselected I need to deselect header checkbox for this I have written JQuery function to achieve this functionality. Design Page------------------------------------------------------------------------- < %@ Page Language="C#" AutoEventWireup="true" CodeFile="TestingPage.aspx.cs" Inherits="TestingPage" %> < !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""> Read More

Export Data From GridView To Excel in

Category: ASP.NETGRIDVIEW Comments: One comment

A good way to display data is to show it in a GridView. However, it becomes difficult to manipulate and filter large amounts of data in this way. Exporting data to an Excel file is a great solution for handling large amounts of data because Excel has many features -- such as sorting, searching and filtering.
Read More