ASP.Net

Nested Gridview binding in asp.net with collapsible feature

ASP.Net GridView binding is really easy but nested binding is a little bit tricky. We need to create two row for every single row one for normal row data and other for nested grid. There are two way to create multiple rows, one is by using the JavaScript by manipulating the html and other is directly from code behind, which we will use in our example, really it is not easy but very easy. We will... By Ali Adravi   On 03 Dec 2014  Viewed: 8,050
  • asp.net
  • gridview
  • c#

ASP.Net MVC Web API AngularJS and Bootstrap application structure

Application structure by using ASP.Net MVC, Web API, AngularJs is not complicated but we need to know what NuGet Packages are required and what can make the application easy and speed up the development. In this article we will use MVC 4, Visual Studio 2012, Web API and AngularJS to create a single page application. We will try to use different folders for keeping our controllers, services,... By Ali Adravi   On 17 Nov 2014  Viewed: 9,576
  • angularjs
  • webapi
  • mvc
  • bootstrap
  • asp.net

ViewData, ViewBag, TempData and Session in MVC

ViewBag, ViewData, TempData and Session are the options to send value from controller to view or to other action method/pages. ViewData and ViewBag are very straight forward, they used to send the data from controller to view and done but in case of TempData and Session we can pass values from controller to view and even we can get our value from other pages after redirecting. As we know TempData... By Ali Adravi   On 15 Nov 2014  Viewed: 4,410
  • mvc
  • asp.net

Send email in background thread in C# aps.net

How to send email in a new thread in asp.net by using Gmail account or any other account or you can say a page where we can test out all the settings like SMTP Server, Email From, Email To, Email Password, Port Number, Email DeliveryMethod or Secure Socket etc. In this article we will see how to send email in background thread with CCed and BCCed functionality. Here is the page... By Hamden   On 13 Sep 2013  Viewed: 16,296
  • email
  • asp.net
  • c#

Insert, update and delete in asp.net gridview step by step

We will do insert, update and delete functionality in a GridView with modal popup, we will proceed step by step to learn how easily we can complete this functionality in any project. We will try to create a basic user page where you can see all the users in a grid with paging and buttons to add new user, update an existing user and delete any existing user with confirmation box. We will always... By Hamden   On 01 Sep 2013  Viewed: 21,517
  • asp.net
  • gridview
  • insert
  • update
  • delete

Abstract Class in C# with Example

The purpose of an abstract class is to provide a common definition of base class that multiple derived classes can share, and can be used only as a base class and never want to create the object of this class. Any class can be converted into abstract class by adding abstract modifier to it. Common features of an abstract class: 1. An abstract class cannot be instantiated. 2. An abstract class... By Ali Adravi   On 21 Aug 2013  Viewed: 15,318
  • c#
  • asp.net
  • oops

MVC insert update delete and select records

CRUD (Create, Retrieve, Update and Delete) in MVC. When we start to learn new language, first we try to run an application with “Hello World” and then CRUD functionality. So in this article we will see how to select records from database (with WebGrid, pagination and sort functionality), update a record, add new record and finally delete a record in ASP.Net MVC. Let’s create a simple table... By Ali Adravi   On 17 Aug 2013  Viewed: 96,841
  • mvc
  • asp.net
  • sql server

Convert object to json and json to object in C#

In this article we will see how to convert an object to json string or how to convert a json string to an object in C#, we will try to write a generic class with two methods, one for converting an object to json and other for converting json string to an object. I searched internet to get if there is anything like this with .net but could not found any which we can use directly, so let's... By Ali Adravi   On 16 Jun 2013  Viewed: 38,204
  • json
  • c#
  • asp.net

Gridview multiple header rows

How to show multirow header in gridview in asp.net? i was searching for this question but could not found any easy way so I decided to try my own and found it is not so difficult. Simply we can use header template and item template and design it according to our requirements. we will see this in action in this article. First let's see what we are going to do, here is the final output which we... By Ali Adravi   On 30 May 2013  Viewed: 38,098
  • gridview
  • asp.net

Cookies in asp.net with examples

We will discuss here, what are cookies, why we need cookies, what are the limitation of cookies, when we need to use cookies with example code in asp.net and many more. ***what are cookies:*** HTTP Cookie, Web Cookie, Browser Cookie, Session Cookie, etc. are some names of the cookies. Cookies are small text file sent by web server and saved by browser on client machine. We need cookies to... By Myghty   On 26 May 2013  Viewed: 1,922
  • cookies
  • asp.net

ASP.Net MVC file upload

How to upload file or image in asp.net mvc is not difficult but is totally different compare to asp.net FileUpload control. If we are asp.net developer and we are new to mvc then we immediately noticed we don’t have server side controls so the FileUpload control as well and our problem start here. Now we start searching how to upload a file if there is no FileUpload control, no problem whatever... By Ali Adravi   On 25 May 2013  Viewed: 7,264
  • mvc
  • asp.net
  • file-upload

Convert string to an enum type in .net

Sometime we need to convert string to an enum type, say I need to store my enum value into viewstate then we cannot store enum or any object to viewstate so converted that to string and store it, and on postback need to read the viewstate and convert to enum, so how to convert a string into enum? We will see this in this article. Let’s say our enum is like this: Public enum ReportType ... By Hamden   On 21 May 2013  Viewed: 1,234
  • enum
  • c#
  • asp.net
  • oops

Ajax AsyncFileUpload control example in asp.net to upload only images

Ajax introduced two new controls AsyncFileUpload and SeaDragon, in this article we will see about Asynchronous file upload control, with its different properties and usage. 1. [AsyncFileUpload][1]: by using this control we can upload a file asynchronously (without postback). The file uploading results can be checked both in the server and client sides. 1. [SeaDrago][2]: The Seadragon... By Ali Adravi   On 20 May 2013  Viewed: 5,668
  • ajax
  • asp.net

Bind multiple value for hyperlink in gridview

When need to use a JavaScript function with multiple parameters and those parameter values need to be bind at the time of binding the gridview data then it really becomes complicated, say we have a function GetLatLong which calculates Latitude and Longitude by using city, state, Country and zip code, say our function is something like this function GetLatLong(var city, var state, var... By Ali Adravi   On 20 May 2013  Viewed: 2,243
  • asp.net
  • gridview
  • binding

Readonly textbox postback issues and solutions

In many cases we need to use read only text box so user cannot edit the value but readonly textbox will lost its value after postback. Let’s say you have a read only text box to set date by using ajax calendar so after post back date will be lost, other case might be you are setting some value in design view of aspx page which will lost after post back. Suppose you have following HTML in your... By Ali Adravi   On 24 Apr 2013  Viewed: 2,807
  • asp.net

Call code behind method from JavaScript in asp.net

There are ways to call a web service method JavaScript, for more detail you can see [how to retrieve data from database using JavaScript in asp.net][1], but is there any way to call a normal method from JavaScript? And the answer is No; show how we can call a code behind method from JavaScript, let’s see this with code Add following HTML on page: <asp:ScriptManager ID="ScriptManager1"... By Jonathan King   On 08 Apr 2013  Viewed: 10,656
  • asp.net
  • javascript

Ajax Modalpopupextender show hide from code behind and by javascript

In this article we will discuss different way of show and hide (open and close) modal popup by using Ajax ModalPopupExtender, how to open/close a modal popup from code behind in asp.net or by using JavaScript, how to use multiple buttons to hide the modal popup in asp.net etc. Suppose we have a grid view to show the record in tabular format and give functionality to edit a record from grid... By Jonathan King   On 08 Apr 2013  Viewed: 26,186
  • ajax
  • javascript
  • asp.net

Array in C# - single, multiple and jagged array

An array can be initialized in several ways, it can store a single value or series of values, every element must be set of same type, C# supports single-dimensional arrays, multidimensional arrays (also call rectangular array) and array-of-arrays (referred jagged arrays), let’s discuss features of array in C# like how to declare array in C#, How to initialize values to an array, how to define the... By Ali Adravi   On 24 Mar 2013  Viewed: 3,319
  • c#
  • array
  • asp.net

Use XSLT to create menu from database

In some situations we need to create website menu from database, say our application have ability to create pages so that must also need to have a menu item to go to that page. So how to create menu with all those nice CSS and other settings, I think XSLT is best to use in these situations. Let’s see what we would need to create our menu 1. Procedure to get data from database in xml... By Hamden   On 16 Mar 2013  Viewed: 1,092
  • html
  • xml
  • asp.net

XmlDocument Vs XDocument and their usage

When there was XmlDocument why we need XDocument, is there any better feature available with XDocument, answer is yes, XDocument has a number of benefits, easy to create, easy to update, easy to search, ability to use LINQ to XML, cleaner object model etc. In this post we will see some examples and difference of code while using XmlDocument and XDocument; we will discuss some way to convert... By Ali Adravi   On 16 Mar 2013  Viewed: 1,908
  • xml
  • asp.net
  • c#
123