Loading ...

Who is online?  0 guests and 1 members
home  »  blogs  »  mohit kumar

Communifire Blogs

mohit kumar : Most Recent postings

mohit kumar

How to handle exceptions in ASP.NET

11/3/2010 by mohit kumar · 1 · 1635

If you are developing an application, you should prepare for exceptions in your application. Exceptions are part of the applications. An exception means an error and it is run time error. In this blog I will explain how to avoid these unwanted exceptions in your applications. Exceptions – As I already told you that exception is not a compile time error. Exception is a run time error. We ...

mohit kumar

Abstract class in C sharp

11/3/2010 by mohit kumar · 0 · 2254

There are different types of classes in C sharp like Sealed, Abstract, Partial, etc. In this blog I will explain abstract class in C sharp. Abstract class is very useful in C sharp. Below you will learn about Abstract class, Abstract methods and Abstract properties. There is main difference in Abstract class that Abstract class can’t be instantiated. An Abstract class is only a base clas...

mohit kumar

ASP.NET : How to open an alert box from user control?

10/27/2010 by mohit kumar · 0 · 3909

Today someone asked on forums that how to open a alert box from user control.So I am writing a blog on it. There is a user control and an aspx.page. In user control, I have one button and in user control's code behind file alert box code. User Control Code - <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="testQuestionUC.ascx.cs" Inherits="WebProjects.UserControl.testQuest...

mohit kumar

ASP.NET: What is AutoEventWireup

10/27/2010 by mohit kumar · 1 · 1991

Beginners are always confused about AutoEventWireup attribute of a Page directive. In this blog, I will explain AutoEventWireup and try to help out beginners. I hope programmers wouldn’t confuse about AutoEventWireup attribute after read this blog. When I create a new aspx page, Page directives have four attributes – Language, AutoEventWireup, CodeFile, and Inherits. AutoEventWireup – Au...

mohit kumar

Get datetime out in 3 dropdownlists (day, month, year)

10/22/2010 by mohit kumar · 2 · 3411

Today I have read a question on forums asp.net. So I thought I should write a blog on this. Question - How do I get Date, month, year in three different dropdownlist? Well below you will see you how we can show Date, Month and Year in three different dropdownlist. Code - <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title>...

mohit kumar

What is IsPostBack in ASP.NET?

10/4/2010 by mohit kumar · 0 · 2540

Every Beginner have confused about IsPostBack property. Below you will find a very simple example of IsPostBack property. IsPostBack property returns Boolean value. It is used to determine if data is being sent back to the Web server or if the Web page is simply being requested. Example :- <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Untitled...

mohit kumar

Object reference not set to an instance of an object in .net

8/21/2010 by mohit kumar · 0 · 5788

When programmers use and manipulations with a null object, they always faced an error. The error is ‘ Object reference not set to an instance of an object .’ In below example I will show you that how this error comes and how we can solve this problem. Error - Let’s say you are getting value from the database. When you are getting value from the database, you would get an about error. Now...

mohit kumar

Input string was not in a correct format in .net

8/18/2010 by mohit kumar · 1 · 5146

I have seen many times a question on Internet which is “Input String was not in a correct format”. I have also faced this error. This is run time error. Types of Error – Compile time error (Syntax error, etc.) Runtime error (Division by zero, etc.) As I told you that “Input string was not in a correct format” is a runtime error. Mostly it comes when we convert a string to a number or con...

mohit kumar

Textbox, Radio button list, Checkbox and Dropdown list selector in jQuery

8/4/2010 by mohit kumar · 7 · 8784

In this blog I will explain how I can use Textbox, Radio button list, Checkbox and Dropdown list selector in jQuery. What is selector? Selector is backbone of jQuery language. Selector means you can select an element or group of Elements to perform any action. Example:- <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script sr...

mohit kumar

Literal control in ASP.NET

7/22/2010 by mohit kumar · 7 · 2406

In this blog I will explain Literal control in ASP.NET. The Literal control used to display static text on a web page. Literal control is not rendered as a <span> tag like label control. The Literal control doesn’t inherit from WebControl and we can’t apply style to its content because it doesn’t have a style property. There is a Mode property of Literal control. There are three mo...

mohit kumar

How can we find highest second and lowest second number in a particular array?

7/15/2010 by mohit kumar · 0 · 1968

Yesterday, I was sitting with my college friends at a coffee shop. One of my friends asked me a question that how we can find highest second and lowest second number in a particular array, and without the help of any function like orderBy. So, I took a notebook and solved his question. Now I am writing a blog on that logic as I want to share my logic with everybody. Here is my code:- usi...

mohit kumar

How to generate set of 10 unique random numbers

7/8/2010 by mohit kumar · 6 · 2656

Today one of my colleague asked me a simple question that how I can generate set of 10 unique random numbers. First I thought it is very simple but later I found it’s very logical. So I thought I should write a blog on this. Here is my code - using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public p...

mohit kumar

How To Insert Data Using Web Service

7/3/2010 by mohit kumar · 0 · 9237

Web Service – Web Service is a huge thing in ASP.NET. Using web Service, We can create robust web applications. We can create Web service’s methods and that function can be accessible to the rest of the world. ASP.NET provides easy way to develop Web services. With the help of Web services we can share data across different platforms. In this blog I will explain only how to insert data i...

mohit kumar

Find Control In Nested Data List

5/16/2010 by mohit kumar · 0 · 7283

In this blog I will explain how to find control in nested Data list. I will also tell you how you can bind nested Data list. In below code there is a class file (DummyData.cs) and a page (NestedDatalist.aspx). Here is my code:- NestedDatalist.aspx <%@ Page Language="C#" AutoEventWireup="true" CodeFile="NestedDatalist.aspx.cs" Inherits="NestedDatalist" %> <!DOCTYPE html PUBLIC "-...

mohit kumar

File upload with validation in ASP.NET

4/18/2010 by mohit kumar · 0 · 6207

In this blog I will explain how to upload some particular file upload in ASP.NET. In below code there is a fileupload (fuTest) and a button (btnUpload) control. <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <table> <tr> <td><asp:Fi...

mohit kumar

Data types in C sharp

4/11/2010 by mohit kumar · 0 · 2176

In this blog I will tell how many Data types in C#. There are following Data types built into C# and each one stores a different kind of data. Note: whole number – its means it doesn’t have a decimal point. Data Type Description Bits int int can store any whole Number from -2,147,483,648 to 2,147,483,647 32 bits string String can hold text of any length bool bool is a Boolean value it’s ...

mohit kumar

Prevent Duplicate Value in a Table

4/7/2010 by mohit kumar · 0 · 3234

In this blog I will explain how to prevent duplicate value in a table. I have a Student form. In this form user can insert student’s details. But duplicate value in Roll No field isn’t allowed. In below example I show you how you can stop duplicate value in a field. Here is my code:- In this StoredProcedure I am checking Roll no, if it is already exist then it won’t save in database. CRE...

mohit kumar

Write Text file in ASP.NET

3/28/2010 by mohit kumar · 2 · 23427

In this blog I will explain how to write a text file in ASP.NET. Here is my code:- There is a Textbox and one button. You can type your name in textbox and it will write into your text file. You can check your text file in D drive (D:\). ASPX Code:- <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <for...

mohit kumar

Change text with jQuery

3/27/2010 by mohit kumar · 0 · 9398

Last week I have checked a website. In that website I saw my name and when I clicked on my name, it changed into a textbox and asks me update for my name. I found it very good. Today I have created a new dummy project on this functionality. Here is my Code:- <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title></title> <script typ...

mohit kumar

Insert value in Textbox on Checkbox‘s checked event

3/26/2010 by mohit kumar · 0 · 3572

Today I was working on checkbox. I have faced a problem and problem was how I can insert value in Textbox on Checkbox‘s checked event (without postback) . But at last I have solved this problem.I thought I should write a blog that how we can insert value in textbox on Checkbox’s checked event. Here is my dummy project:- In below code there are three checkboxes and one textbox. When user ...

mohit kumar

Alert Box From ASPX Code-Behind Code

1/20/2010 by mohit kumar · 5 · 5894

In this blog I will explain how to open a JavaScript alert from Code-behind file. I want to show ‘Welcome’ alert on page load. Below is my code:- protected void Page_Load(object sender, EventArgs e) { Response.Write("<script>alert('Welcome')</script>"); } Happy Coding:)

mohit kumar

DataTable in ASP.NET

1/14/2010 by mohit kumar · 0 · 6297

In this blog I will explain how to create DataTable. here is my code:- creating Table first- private DataTable myTestTable() { DataTable myTable = new DataTable(); DataColumn myColumn; myColumn = new DataColumn(); myColumn.DataType = Type.GetType("System.String"); myColumn.ColumnName = "Name"; myTable.Columns.Add(myColumn); myColumn = new DataColumn(); myColumn.DataType = Type.GetType("S...

mohit kumar

Unique constraint in SQL

12/16/2009 by mohit kumar · 0 · 1602

In this blog I will explain Unique constraint in SQL.If i create a UNIQUE constraint, i can't insert duplicate data in that column. The UNIQUE constraint ensures that all values in a column are distinct. Example i have created a Table:- CREATE TABLE UNIQUE_EXAMPLE ( ID INT UNIQUE, Name VARCHAR(50) ) Now I am inserting data in UNIQUE_TABLE:- INSERT INTO UNIQUE_EXAMPLE values ('1','Mohit')...

mohit kumar

two-dimensional array in C Sharp

12/15/2009 by mohit kumar · 0 · 7183

In this blog I will explain how to use two-dimensional array in C#. Here is my aspx code:- <body> <form id="form1" runat="server"> <div> <asp:TextBox ID="txt2dArray" runat="server" TextMode="MultiLine"></asp:TextBox> </div> </form> </body> Here is my Code behind code:- namespace Test { public partial class _Default : System.Web.UI.Page { pr...

mohit kumar

Generate Random Number In JavaScript

11/24/2009 by mohit kumar · 0 · 2409

In this Blog I will explain how we can gernerate random number. Example - <HTML> <HEAD> <SCRIPT type="text/javascript"> function GenerateRandomNo() { var _date=new Date() var ran_num=(_date.getSeconds())%10 var ran_num=ran_num+1 alert(ran_num) } </SCRIPT> </HEAD> <BODY> <form> <INPUT TYPE="button" VALUE="Generate Number from 1 to 10" onClick="...

  • Page 1 of 2 (40 items)
  • « Previous 
  • 1
  • 2
  • Next »
  •   Go to page:  [Go]

Product Spotlight

ASP.NET Hosting Spotlight

Join CodeAsp.Net for FREE Today!

It's fast, easy and free! Submit articles, get your own blog, ask questions & give answers in the forums, and become a better developer, faster.

enter your email address:

 

Quick Vote

What kind of email newsletter would you prefer to receive from CodeAsp.Net?