<asp:GridView ID="Grid_product" runat="server" OnRowDataBound="Grid_product_RowDataBound"  AutoGenerateColumns="true">
  </asp:GridView>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ArrayList arrl = new ArrayList();
                arrl.Add("Profit"); arrl.Add("Lost"); arrl.Add("Null");                                 arrl.Add("Null"); arrl.Add("Lost"); arrl.Add("Profit"); al.Add("Profit");                this.Grid_product.DataSource = arrl;
                this.Grid_product.DataBind();
            }
        }

 protected void Grid_product_RowDataBound(object sender, Grid_productRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                if (e.Row.Cells[0].Text == "Profit")
                {
                    e.Row.Cells[0].ForeColor = System.Drawing.Color.Red;
                }
                else if (e.Row.Cells[0].Text == "Lost")
                {
                    e.Row.Cells[0].ForeColor = System.Drawing.Color.Black;
                }
                else
                {
                    e.Row.Cells[0].ForeColor = System.Drawing.Color.Green;
                }
            }
        }
the javascript on code behind alert message with page redirect on the following code

ScriptManager.RegisterStartupScript(this,this.GetType(),"redirect",
"alert('Registration Successfully !'); window.location='" + 
Request.ApplicationPath + "Default.aspx';",true);

This is a program code which will provide info about -Ajax calender extender with java script to the developer.It will mostly used to select dates like birthdate.If user wants to select any dates prior to current date then s/he will not able to select any future date.


<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>devloper4u</title>

    <script type="text/javascript">
        function CurrentDateShowing(e) {
            if (!e.get_selectedDate() || !e.get_element().value)
                e._selectedDate = (new Date()).getDateOnly();
        }     
    </script>

    <script type="text/javascript">
        function CheckDateEalier(sender, args) {
            if (sender._selectedDate > new Date()) {
                alert("Day earlier than today cannot be selected.");
                sender._selectedDate = new Date();
                sender._textbox.set_Value(sender._selectedDate.format(sender._format))
            }
        }
        
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div>
      <asp:TextBox ID="txtDOB" runat="server"></asp:TextBox>
                                <asp:ImageButton ID="Imgbutton1" runat="server" ImageUrl="~/images/Calendar_scheduleHS.png" />
                                <cc1:CalendarExtender ID="CalendarExtender2" runat="server" Format="dd/MM/yyyy" PopupButtonID="Imgbutton1"
 TargetControlID="txtDOB" OnClientDateSelectionChanged="CheckDateEalier">
                                </cc1:CalendarExtender>
    </div>
    </form>
</body>
</html>

put the javascript on the header Part 


  <script type="text/javascript" language="javascript">
        function callprinter(p) {
            var k = document.getElementById(p);
            var wp = window.open('', '', 'left=1000,top=1000,width=800,height=1280,toolbar=0,scrollbars=0,status=0');
            wp.document.write(k.innerHTML);
            wp.document.close();
            wp.print();
        }
    </script>

put the code in Body part 

 <div id="print11" style="width: 100%; border: 2px solid #ccc; background-color: #fff">

if you selected section on design hear in this div 

</div>

Button On Click To Print 


 <asp:Button ID="lnkprint" runat="server" Text="Print"  Width="100px"
                    OnClientClick="javascript:callprinter('print11');"  />



CREATE PROCEDURE dbo.Delete_register_mst
@intglcode int
AS
delete from register_mst
where intglcode=@intglcode
RETURN