-->

Friday, October 4, 2013

How to deploy a MVC project from inbuilt server to localhost

Also you can say how to deploy a mvc project from inbuilt server to another server such as
Before  address --  localhost:34376
After Address--  localhost:8080

Step-1 : Open Visual studio in administrator mode.
Step-2:  Open your MVC project
Step-3: Right Click on Your MVC project name and select properties.
project property window in asp.net


Step-4: In open window (below snap) , your application run on default server port such as 34376
project property window in asp.net

Step-5 :  Save your application and run.
How to deploy  a MVC project  from inbuilt server to localhost


Step-6 : Again open project property window and change your current server  to local server  also click to create virtual directory button, check below snap
project property window in asp.net

Step-7:  Save your Application and run

How to deploy  a MVC project  from inbuilt server to localhost

ASP.NET: Change CheckBox Text in code file

How to change control text in code file

If you want to change text of the control in code file then you must use text property of the control in code file. Simple you can say

ControlId.Text = " Assign Text in double quotes";
 lets take a simple example to change CheckBox text , alignment of the text and color of the Text.
<%@ 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)
    {
        CheckBox1.Text = "change text of the control";
        CheckBox1.TextAlign = TextAlign.Left;
        CheckBox1.ForeColor = System.Drawing.Color.Green;
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Change CheckBox Text in Code file</title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:CheckBox ID="CheckBox1" runat="server" Text="CheckBox Text Change" />
    <br />
    <br />
    <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Change Text"
        Width="85px" />
    <div>
   
    </div>
    </form>
</body>

</html>
Output
ASP.NET: Change CheckBox Text in code file

ASP.NET: Change CheckBox Text in code file

Change visibility property dynamically in ASP.NET

Introduction

Every control having a visibility property means you can hide or visible a control at any time any where. Bydefault every control set true in visibility. lets take a simple example take a web form and place control onit. Also set visibility property.

Example

ControlId.Visibility = True/false;

<%@ 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)
    {
        CheckBox1.Visible = false;
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Visibility Property of the control</title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:CheckBox ID="CheckBox1" runat="server" Text="CheckBox Visible" />
    <br />
    <br />
    <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Hide"
        Width="85px" />
    <div>
   
    </div>
    </form>
</body>
</html>
Output
Change visibility property dynamically in ASP.NET

Change visibility property dynamically in ASP.NET

Thursday, October 3, 2013

Change DropdownList Width Dynamically in ASP.NET

Every control have a width property . In width property you can assign any unit value such as 10, 20 and any other number.If you want to change width of the control at runtime then you must assign width to the DropdownList at runtime such as

DropdownList1.Width = 20;

Lets take an simple example.

<!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)
    {
        DropDownList1.Width =int.Parse("50");
       
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:DropDownList ID="DropDownList1" runat="server">
            <asp:ListItem>Hyperlink</asp:ListItem>
            <asp:ListItem>CheckBox</asp:ListItem>
            <asp:ListItem>Label</asp:ListItem>
            <asp:ListItem>Panel</asp:ListItem>
        </asp:DropDownList>
        <br />
        <br />
        <asp:Button ID="Button1" runat="server" Text="Change Width"
            onclick="Button1_Click" />
    </div>
    </form>
</body>

</html>
Output
Change DropdownList Width Dynamically in ASP.NET
Change DropdownList Width Dynamically in ASP.NET


Difference between Linear search and Binary Search in c language

SQL Video Channel : Download all SQL Video



Works only on sorted items. such as 
1,2,3,4,5,6  etc

Works on sorted as well as unsorted items.
12,4,5,3,2,1 etc
Very efficient if the items are sorted
Very efficient if the items are less and present in the beginning of the list. such as
Suppose your list items are :
12,3,4,5,1
and you want to search 12 number then you get beginning in the list.
Works well with arrays and not on linked lists.
Works with arrays and linked lists.

Number of comparisons are less
More number of comparisons are required if the items are present in the later part of the array or its elements are more.

How to bind DropdownList using Array in ASP.NET

If you want to bind dropdownlist using array in asp.net then first add item to the array on page_Load event.
After that pass dataSource as array name to DropdownList. lets take a simple example for binding dropdownlist on page load.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>

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

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>How to bind dropdownlist using array</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
             Height="23px"
            Width="173px">
        </asp:DropDownList>
        <br />
        <br />
    </div>
    </form>
</body>
</html>
Codebehind


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string[] arr = new string[] { "Your first item", "Your Second Item", "Your third item" };
        DropDownList1.DataSource = arr;
        DropDownList1.DataBind();


    }
 

}
Output
How to bind DropdownList using Array in ASP.NET

Dynamically change checkbox border color in ASP.NET

If you want to change Border-color of the checkbox programmatically then you should use Border-color  property at codebehind.
lets take a simple example for completing the task. Take a webform control and place one checkBox and one button control onto the design window. Now at time we can handle onClick event.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default4.aspx.cs" Inherits="Default4" %>

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

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:CheckBox ID="CheckBox1" runat="server" BorderColor="Red"
            BorderStyle="Dotted" BorderWidth="4px" Text="CheckBox for multiple selection" />
        <br />
        <br />
        <asp:Button ID="Button1" runat="server" onclick="Button1_Click"
            Text="Change Border Color" />
    </div>
    </form>
</body>
</html>

Codebehind

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Default4 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        CheckBox1.BorderColor = System.Drawing.Color.Green;
    }

}
Output
Dynamically change checkbox border color in ASP.NET

Dynamically change checkbox border color in ASP.NET

© Copyright 2013 Computer Programming | All Right Reserved