-->

Friday, October 25, 2013

ASP.NET: Programmatically change CheckBoxList Border style

Lets take an simple Example

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

    protected void Button1_Click(object sender, EventArgs e)
    {
        CheckBoxList1.BorderStyle = BorderStyle.Dashed;
     
       
    }

    protected void Button2_Click(object sender, EventArgs e)
    {
        CheckBoxList1.BorderStyle = BorderStyle.Dotted;
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>CHANGE BORDER STYLE PROGRAMMATICALLY</title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:CheckBoxList ID="CheckBoxList1" runat="server" Height="24px" Width="208px">
        <asp:ListItem>ASP.NET CONTROLS</asp:ListItem>
        <asp:ListItem>JAVA CONTROLS</asp:ListItem>
        <asp:ListItem>TURBO CONTROLS</asp:ListItem>
        <asp:ListItem>PYTHON CONTROL</asp:ListItem>
    </asp:CheckBoxList>
    <div>
   
        <br />
        <asp:Button ID="Button1" runat="server" onclick="Button1_Click"
            Text="DASHED BORDER STYLE" Width="178px" />
   
        <br />
        <br />
        <asp:Button ID="Button2" runat="server" onclick="Button2_Click"
            Text="DOTTED BORDER STYLE" Width="178px" />
   
    </div>
    </form>
</body>

</html>
Output

ASP.NET: Example of Programmatically change CheckBoxList Border color

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

    protected void Button1_Click(object sender, EventArgs e)
    {
        CheckBoxList1.BorderColor = System.Drawing.Color.Red;
        CheckBoxList1.BorderStyle = BorderStyle.Dashed;
        CheckBoxList1.BorderWidth = int.Parse("3");
       
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>How to change border color of the CheckBoxList Border color </title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:CheckBoxList ID="CheckBoxList1" runat="server">
            <asp:ListItem>C++ Tutorial</asp:ListItem>
            <asp:ListItem>Java Tutorial</asp:ListItem>
            <asp:ListItem>ASP.NET Tutorial</asp:ListItem>
            <asp:ListItem>Turbo C Tutorial</asp:ListItem>
        </asp:CheckBoxList>
        <br />

        <br />
        <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Change" />
        <br />
        <br />
    </div>
    </form>
</body>

</html>
Output
ASP.NET: Example of Programmatically change CheckBoxList Border color

Difference between ASP.NET and ASP.NET AJAX

ASP.NET

 is a web development model, which is used to deliver interactive, data-driven Web application over the internet. It also consists of a large number of controls, such as a text boxes, button and labels for assembling , configuring, and manipulating code to create hyper Text Markup Language (HTML) pages. You can create ASP.NET application using any CLR compliant language such as Visual basic, C#, Visual c++ and j#. The main features of ASP.NET are as follows.

Better Performance – When you request a Web page for the first time after compiling ASP.NET code, the CLR complies the code and stores the cached copy of the result. Now, for any subsequent calls to the same pag, the cached copy of the result is retrieved instead of going back to the server.

Improved security –ASP.NET has four different methods of authentication:
1. Forms—Allows the ASP.NET application to use its own custom business logic for authentication.
2. Windows—Checks the identity of user against the Windows user accounts that are stored on the web Server. If the credentials of a user match with that of a Windows user account, then the user is authenticated.

Greater Scalability- The session states in ASP.NET are maintained in a separate process on a different machine or database. This enables cross-server sessions to occurs, solving the problem of Web forms when more web servers need to be added as the traffic grows.

Cookie-less Sessions—ASP.NET stores the session state even when the cookies in a Web Browser are disabled. In such a case, the session ID is passed as a part of the Uniform Resource Locator (URL).

Ajax,

 formerly code named as Atlas, is an extension of ASP.NET for developing and implementing AJAX functionality. ASP.NET AJAX Includes both client-side and server-side components that allow the developers to create Web application that are capable to update the data on a website without a complete reload of the page

The following are the advantages of using AJAX:
Asynchronous – Enable asynchronous calls to the web server without making the users wait for the data.

The minimal transfer of the data –Helps in sending only a part of the modified data to the web server minimizing the network traffic and performing the operations quicker. This feature is useful in sites where restricted pipes are allowed for data transfer resulting in improved network performance.

Minimal processing on the web server – Minimizes the processing on the web server as only the necessary data needs to be sent. Now, the server is not required to send a full page back to the server. 

ASP.NET: Programmatically change CheckBoxList Background Color

In previous example we already explain How to use CheckBoxList Control. If you want to change BackGround color on OnIndex change method then use this algorithm.
Step-1 : Add item to the CheckBox List using Show smart tag
Step-2 : Handle SelectedIndexChanged Event
Step-3 : If you want to change  BackGorgound color of the CheckBox List according to CheckBoxList Item then don't use System color enumeration.
Step-4 : Add Style Attribute in every selected item of CheckBoxList.

Complete Code:
<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

    protected void CheckBoxList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        foreach (ListItem  item in CheckBoxList1.Items)
        {
            if (item .Selected)
            {
                CheckBoxList1.Attributes.Add("Style", "BackGround-color:" + CheckBoxList1.SelectedItem.Text); 
            }
        }
       
       
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Change CheckBoxList BackGround Color</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
   
        <asp:CheckBoxList ID="CheckBoxList1" runat="server" AutoPostBack="True"
            onselectedindexchanged="CheckBoxList1_SelectedIndexChanged">
            <asp:ListItem>Red</asp:ListItem>
            <asp:ListItem>Green</asp:ListItem>
            <asp:ListItem>Yellow</asp:ListItem>
        </asp:CheckBoxList>
   
    </div>
    </form>
</body>

</html>
   Output
ASP.NET: Programmatically change CheckBoxList Background Color

ASP.NET: Programmatically change CheckBoxList Background Color

ASP.NET: Programmatically change CheckBoxList Background Color

Thursday, October 24, 2013

Online Examination Cell project in ASP.NET

Introduction

Examination cell conduct all activity  related to examination cell such as sheet allotment, room allotment ,etc. Directly you can say its a college management ERP software which handle all such types of activities.

This types of project conduct some types of functionality like:


  • Administrator has a privilege to create, modify and delete the test papers and its particular questions.
  • User can register, login and give the test with his specific id, and can see the results as well
  • Technical college software’s examination module is mainly concerned upon
  • In-college examination including sessionals and practical
  • External exams management
  • Admit card managing
  • External exams managing of colleges centered in the college
  • Schedule management
  • This module will look upon all basic as well as advanced needs of an examination cell.

Module of the project

This Project is dividing into the three Types of user

  1. Super user.
  2. Administrator.
  3. Faculty member
  4. Student

Super user
Super user is the top level faculty of organization. Handle many modules by the super user. Like
  • Create user.
  • Allotted Course To The Faculty.
  • Send Message To The Faculty.
Administrator
An administrator is the Exam –cell in charges of organization also handle many modules by the Administrator Like
  •  Sheet allotment.
  •  Duty chart.
  •  Paper Collection.
  •  Report generation.
  •  Notice generation.
  • University result
  •  Model exam question papers
  • Unit/sessional test time table
  •  Current News
  •  Course allotment
  •  Paper Collection
If you want to purchase this please contact me on :  narenkumar851@gmail.com

Wednesday, October 23, 2013

How to Create a List of Item, with Multiple Fields: C#

If read more about DataTable, then follow How to Use DataTable in C#.

DataTable is the tabular form of data we are storing. Now to create a list, we have to create a list that can contains our desired set of data. List resides in System.Collection.Generic namespace of visual studio. Let suppose, we have a student class with some common properties like name, age, city, and date of birth.

To create a list, just create a list object type of student as in following line of c# code:
public class Student
{
public string Name { get; set; }
public int Age { get; set; }
public string City { get; set; }
public DateTime Dob { get; set; }
}

And the list object will create by the following line:

List<Student> stuList = new List<Student>();

This list can be used further like to insert new record of student, to bind this list with datagridview, to store temporary data from the database and many more. A list have many in-built functions, we have to just analyse them and use them.

This list is empty by default and can contains student type of data only. To insert some data in this list, we have to create a new object of student and then call the add() method of list. The add() method requires a parameter of student type. The syntax of method to add a new student is:
stuList.Add(new Student()
{
Name = "Jacob",
Age = 29,
City = "London",
Dob = new DateTime(1984, 5, 26)
});

This will add a single record of student with above details. We can add as many record as per our requirement.

In the next post we will use some in-built functions which requires Basics of LINQ language.

Tuesday, October 22, 2013

How to check either the CheckBox is Checked or Not

Introduction

You can perform different types of operation on CheckBox Status such as you can check your item either is selected or not. If your CheckBox checked status is true then your CheckBox is selected.

Application of CheckBox Checked status

1. For cookies enable in Facebook Login page.

How to check either the CheckBox is Checked or Not

Lets take a simple example to check that your CheckBox is checked or not

Complete code
<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

    protected void Button1_Click(object sender, EventArgs e)
    {
        if (CheckBox1.Checked == true)
        {
            Label1.Text = "CheckBox checked";
        }
        else
        {
            Label1.Text = "CheckBox not checked";
        }
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>How to check either the CheckBox is Checked or Not</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <asp:CheckBox ID="CheckBox1" runat="server"
            Text="How to check either the CheckBox is Checked or Not" />
        <br />
        <br />
        <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Check" />
        <br />
        <br />
        <asp:Label ID="Label1" runat="server"></asp:Label>
    </div>
    </form>
</body>

</html>
Output
How to check either the CheckBox is Checked or Not

How to check either the CheckBox is Checked or Not

© Copyright 2013 Computer Programming | All Right Reserved