Thursday, July 30, 2015

Convert text into image and show image preview in asp.net

In this article I am going to explain how to Convert text into image and show image preview in asp.net

Description:
In the previous article I have explained Pass parameter to RDLC report and CreateRDLC report using Store procedure

When users enter text in textbox/input, entered text will be converting into png image and showing its preview.

Tuesday, July 28, 2015

Asp.net: Pass parameter to RDLC report

Sunday, July 26, 2015

Asp.net: Create RDLC report using Store procedure

In this tutorial I am going to explain how to create RDLC report using Store procedure in asp.net

Description:


I have a table Tb_Student and contain the information of student i.e. name, Address(City) and Roll number. In this example I am going to display the all student information in RDLC report.

Implementation:
I have created a table Tb_Student.
Create a store procedure to get data from database table

How to split the string in Asp.net

Saturday, July 25, 2015

Display records in Gridview according to DropDown Selection in Asp.net

In this article I am going to explain how to display records in Gridview according to dropdown Selection in Asp.net

Description:

In this tutorial I am using Gridview and DroDownlist control. Drodown display the name of name of City. When user selects the particular city, detail of students belonging to that (City) will be displayed. E.g. if select the Shimla, student belongs to Shimla city will be displayed.

Friday, July 24, 2015

Asp.net Interview Question: Difference between DataReader and DataAdapter

In this article I am going to differentiate DataReader and DataAdapter


DataReader:
DataReader is a Connection Oriented means require a continuous connection with the data source to accessing it. It is read and forward only. We can’t write/customize the data. It is best choice where we need to display the data only. It is fast as compared to dataset. It stores one row in memory at a time.

Interview Question: Difference between DataTable and dataset in asp.net

In this article I am going to explain the differences between DataTable and dataset in asp.net.


DataTable :
     1.    A DataTable is an in-memory representation of a single database table. It represents a single table and has rows and columns.
     2.      DataTable is less flexible.
     3.      DataTable is lighter because it contains the data of single table only.
     4.      DataTable fetches only one TableRow at a time.
     5.      DataTable , DataSource can’t be serialized.
     6.      There is no DataRelation object in DataTable .
     7.      There is no Unique Constraint and Foreign Key Constraint object available in DataTable.
Example of DataTable:
SqlDataAdapter adp = new SqlDataAdapter("Select * from Tb_Student", con);
        //DataTable  object
        DataTable  dt = new DataTable ();      
        adp.Fill(dt);
        //check the DataTable  contains data or not
        if (dt.Rows.Count > 0)
        {
            grdstudent.DataSource = dt;
            grdstudent.DataBind();
        }

Thursday, July 23, 2015

Select, Edit, update and Delete in Gridview with store procedure using Linq

In this article I will explain how to Select, Edit, update and Delete in Gridview with store procedure using Linq

Description:

I have created a table Tb_Student and having records. To display, Update and Delete the students detail in Gridview create store procedures.

Wednesday, July 22, 2015

Bind Gridview with Stored Procedure using Linq to Sql

In this tutorial I will explain how to bind the Gridview Stored Procedure using Linq to Sql


Implementation:
I have created a table Tb_Student and insert records to it.

Bind Gridview with Stored Procedure using Linq to Sql

Create a store procedure to Get data from database
Create Proc Sp_GetStudentData
As begin
Select * from Tb_Student
end

Add a webform to project/website. Drag and drop the required controls from toolbox to webform.

Tuesday, July 21, 2015

Insert Data into Database using Store procedure in Linq to sql

In this tutorial I will explain how to insert Data into Database using Store procedure in DLINQ ( Linq to Sql)


Implementation:
Create a table Tb_Student

Insert Data into Database using Store procedure in Linq to sql


Create a store procedure to insert data into database
Create Proc Sp_InsertStudents
(
@sname varchar(50),
@saddress varchar(200),
@rollno int
)
As begin
Insert into Tb_Student values(@sname,@saddress,@rollno)
end 

Asp.net: Increase the maximum upload file size

In this article I am going to explain how to Increase the maximum upload file size in Asp.net.

Description:
Default maximum size to upload file is 4 MB (4096KB) and execution time is 110 seconds. if we are uploading files larger than 4 MB we get an error “Maximum request length exceeded.”

Implementation:
Add the below given line in web.config of project/website.

<system.web>
   <httpRuntime maxRequestLength="51200" executionTimeout="9999" />
</system.web>

MaxRequestLength: Maximum file upload size. Here file upload size is increases to 50 MB.
 1 MB = 1024 KB and 50*1024 = 51200

Error: Maximum request length exceeded

In this post I am going to explain how to solve the error Maximum request length exceeded
Error: Maximum request length exceeded

Description:
Default maximum size to upload file is 4 MB (4096KB) and execution time is 110 seconds. This error occurs when we are uploading files larger than 4 MB.

Solution:
To solve this error add the below given line in web.config of project/website.

Asp.net: How to set session timeout using web.config

In this article I am going to explain how to set session timeout in Asp.net application using web.config

Description:

By default session timeout time is 20 minutes but in many cases we have to change (increase or decrease) the session time. In this example I am going to change the session timeout using web.config from 20 minute to 40 minute.

Monday, July 20, 2015

Solution: WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for jQuery

In this article I am going to explain how to solve the error: WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for jQuery

Description:
I have faced an error while I am working on Asp.net “WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for 'jquery'. Please add a ScriptResourceMapping named jquery(case-sensitive).

Asp.net: Highlight the selected page number in Gridview Control

In this article I am going to explain how to highlight the selected page number in Gridview Control in Asp.net

Description:

When we select any page number in gridview pager it is highlight as shown attached snapshot.

Asp.net: Highlight the selected page number in Gridview Control

I want to improve the look and feel of Gridview pager. To change it I have add some CSS style and set the CSS class in PagerStyle. 

Asp.net: Enable pagination (Paging) in Gridview control

In this article I will explain How to enable the pagination (paging) in Gridview control in Asp.net.

Description:

Gridview control has the in-built paging functionality. To enable it we have to set the AllowPaging property to true to enable pagination and handle the OnPageIndexChanging event. When we set the AllowPaging property to true by default Numeric paging mode will work. We can customize the paging mode by setting the property PagerSettings-Mode of Gridview. We have four options NextPrevious, NextPreviousFirstLast, Numeric and NumericFirstLast. Don’t forget to assign the Pagesize.

Sunday, July 19, 2015

Set number of rows to display in Gridview according to Dropdown Selection in Asp.net

In this tutorial I am going to explain how to set number of rows to display in Gridview according to Dropdown Selection in Asp.net

Description:

In this tutorial 5 records are displayed in Gridview on page load and pagination is working. I have added a Dropdownlist control to webform and set value 5, 10, 15. When user selects the 10 from dropdown 10 records will be display in Gridview per page and vice versa.

How to protect the content and images from theft using JavaScript and CSS

In this article today I am going to explain How to protect the content and image from theft using JavaScript and CSS

Implementation:

 I have a page and want to disable the right click on it. Add the below given script in head section of page.
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
    <script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
  <script type="text/javascript">
        $(document).bind("contextmenu", function (e) {
            e.preventDefault();
        });
</script> 

Saturday, July 18, 2015

Easiest way to Disable mouse right click using Javascript

Friday, July 17, 2015

5 simple steps to Create RDLC Report in asp.net

In this article I am going to explain the 5 simple steps to Create RDLC Report in asp.net

Description:
In the previous article I have explained Implement Google like Custom Pagination in Datalist Control in Asp.net and Highlight The Current (selected) Page Number in Repeater Pagination.

Implementation:
I have created a table Student_Detail and having data. I want to display the detail of Students in Report. To create a report using RDLC follow the below given steps.

Wednesday, July 15, 2015

Implement Google like Custom Pagination in Datalist Control in Asp.net

In this tutorial I try to explain how to implement Google like custom pagination in Datalist control in asp.net

Description:

Implementation:
By default Datalist data control doesn’t have paging option. So we have to write the custom code to implement the pagination functionality. In this tutorial I am going to implement the pagination in Datalist data control like Google.
To implement this I am using Two Datalist control (One to display Data and another one for pagination) and two link buttons to go Next and previous page. So drag and drop the required controls from the toolbox to webform.
Add the style to Head section of webform