Saturday, 4 February 2017

/*  menu stick nav */


<nav class="navbar navbar-inverse" data-spy="affix" data-offset-top="300">
  <div class="container">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="#">WebSiteName</a>
    </div>
    <div class="collapse navbar-collapse" id="myNavbar">
      <ul class="nav navbar-nav">
        <li class="active"><a href="#">Home</a></li>
        <li><a href="#">Page 1</a></li>
        <li><a href="#">Page 2</a></li>
        <li><a href="#">Page 3</a></li>
      </ul>
      <ul class="nav navbar-nav navbar-right">
        <li><a href="#"><span class="glyphicon glyphicon-user"></span> Sign Up</a></li>
        <li><a href="#"><span class="glyphicon glyphicon-log-in"></span> Login</a></li>
      </ul>
    </div>
  </div>
</nav>



<style>
  /* Note: Try to remove the following lines to see the effect of CSS positioning */
  .affix {
      top: 0;
      width: 100%;
  }

  .affix + .container-fluid {
      padding-top: 70px;
  }
 
 
 
  .navbar-inverse {
    background-color: #eee;
    border: 1px solid #eee !important;
margin-bottom: 0px !important;
border-radius:0;
padding:0px;
margin:0px;
}



.navbar-inverse .navbar-collapse, .navbar-inverse .navbar-form {
    border:none !important;
}
 
 
  </style>


Friday, 3 February 2017

/*  slider */


<section class="slider">
 <div id="myCarousel" class="carousel slide" data-ride="carousel">
  <!-- Indicators -->
  <ol class="carousel-indicators">
   <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
   <li data-target="#myCarousel" data-slide-to="1"></li>
   <li data-target="#myCarousel" data-slide-to="2"></li>

  </ol>

   <!-- Wrapper for slides -->
   <div class="carousel-inner" role="listbox">
    <div class="item active">
     <img src="images/s5.jpg" width="100%" height="450px" >
    </div>
     <div class="item">
      <img src="images/s4.jpg" width="100%" height="450px" >
     </div>  
      <div class="item">
       <img src="images/s3.jpg" width="100%" height="450px" >
      </div>
   </div>
 </div>
</section>

Friday, 9 December 2016

Media query


@media only screen and (min-width: 992px) and (max-width: 1199px){}  

@media only screen and (min-width: 768px) and (max-width: 991px){}  

@media only screen and (min-width: 700px) and (max-width: 767px){}  

@media only screen and (max-width: 479px){}

@media only screen and (min-width: 480px) and (max-width: 699px){}

Menu

<div class="menu">
<ul>
<li><a href="">Home</a></li>
<li><a href="">n</a></li>
<li><a href="">n</a></li>
<li><a href="">n</a></li>
<li><a href="">n </a></li>
<li><a href="">n </a></li>
</ul>
</div>
<div id="nav-icon1"> <span></span> <span></span> <span></span> </div>
.menu
{
 float: left;
 width: 80%;
}
 .menu ul
{
 margin: 0px;
 padding: 0px;
}
.menu ul li
{
 display: inline-block;
 position: relative;
 background: #fff;
 padding: 21px 29px;
 float: left;
 border-right: 1px solid #03C;
 margin-top: 28px;
}
.menu ul li a
{
 color: #00C;
 text-transform: uppercase;
 font-family: 'Oswald', sans-serif;
 text-decoration: none;
 text-decoration: none;
}








@media only screen and (max-width: 479px) {
 .menu
{
 float: left;
 width: 100%;
 display: none;
}
 .menu ul li
{
 display: inline-block;
 position: relative;
 background: #000;
 padding: 15px 17px;
 float: left;
 border-right: none;
 margin-top: 0px;
 width: 100%;
 border-bottom: 1px solid #fff;
}
 .menu ul li a
{
 color: #fff;
 text-transform: uppercase;
 font-family: 'Oswald', sans-serif;
 text-decoration: none;
 text-decoration: none;
}
#nav-icon1
{
 width: 40px;
 height: 40px;
 position: absolute;
 -webkit-transform: rotate(0deg);
 -moz-transform: rotate(0deg);
 -o-transform: rotate(0deg);
 transform: rotate(0deg);
 -webkit-transition: .5s ease-in-out;
 -moz-transition: .5s ease-in-out;
 -o-transition: .5s ease-in-out;
 transition: .5s ease-in-out;
 cursor: pointer;
 top: 12px;
 right: 0px;
}
#nav-icon1 span
{
 display: block;
 position: absolute;
 height: 3px;
 width: 100%;
 background: #fff;
 border-radius: 9px;
 opacity: 1;
 left: 0;
 -webkit-transform: rotate(0deg);
 -moz-transform: rotate(0deg);
 -o-transform: rotate(0deg);
 transform: rotate(0deg);
 -webkit-transition: .25s ease-in-out;
 -moz-transition: .25s ease-in-out;
 -o-transition: .25s ease-in-out;
 transition: .25s ease-in-out;
}
#nav-icon1 span:nth-child(1) { top: 0px; }
#nav-icon1 span:nth-child(2) { top: 10px; }
#nav-icon1 span:nth-child(3) { top: 21px; }
#nav-icon1.open span:nth-child(1)
{
 top: 18px;
 -webkit-transform: rotate(135deg);
 -moz-transform: rotate(135deg);
 -o-transform: rotate(135deg);
 transform: rotate(135deg);
}
#nav-icon1.open span:nth-child(2)
{
 opacity: 0;
 left: -60px;
}
#nav-icon1.open span:nth-child(3)
{
 top: 18px;
 -webkit-transform: rotate(-135deg);
 -moz-transform: rotate(-135deg);
 -o-transform: rotate(-135deg);
 transform: rotate(-135deg);
}
}

script

/** menu */

$(function() {
  var menuVisible = false;
  $('#nav-icon1').click(function() {
   $(this).toggleClass('open');
    if (menuVisible) {
      $('.menu').css({'display':'none'});
      menuVisible = false;
      return;
    }
    $('.menu').css({'display':'block'});
    menuVisible = true;
  });
  $('.menu').click(function() {
    $(this).css({'display':'none'});
    menuVisible = false;
  });
});



/* sticy * /


<script>
$(document).ready(function() {
var stickyNavTop = $('.menusec').offset().top;
var stickyNav = function(){
var scrollTop = $(window).scrollTop();
if (scrollTop > stickyNavTop) {
$('.menusec').addClass('sticky');
} else {
$('.menusec').removeClass('sticky');
}
};
stickyNav();
$(window).scroll(function() {
stickyNav();
});
});
</script>
<style> 
.menusec{position:relative;}
.sticky {
position: fixed;
width: 100%;
top: 0;
z-index: 100;
border-top: 0;
background:#000;
}
.sticky:before {
position:fixed;
content:'';
left:0px;
top:0px;
background:#000;
width:105px;
height:80px;
}
</style>
/*  font icon */
.menuBtn { position: absolute; right: 0; height: 60px; width: 60px; background: #AB0707; color: #fff; line-height: 60px; text-align: center; }
.menuBtn i
{
font-size:16px;
text-align:center;
padding:20px 0px 0px 0px;
}









Tuesday, 18 December 2012

session c#.net session timeout


protected void btnLearnerSubmit_Click(object sender, ImageClickEventArgs e)

    {
       
        b.flag = 1;
        b.Learnerloginid = txtLearnerName.Text;
        b.password = txtLearnerPass.Text;

     
        DataTable dt = b.login();
        string learnerid =dt.Rows[0][0].ToString();

        Session["learnerloginid"] = learnerid;

        string URL = "LearnerDetails.aspx?id=" + learnerid;
        Response.Redirect(URL);
    }

LearnerDetails.aspx:

string id;

  if (IsPostBack != null)
        {
            id = Session["learnerloginid"].ToString();
            Label1.Text = id.ToString();


            HtmlMeta meta = new HtmlMeta();
            meta.HttpEquiv = "Refresh";
            meta.Content = Convert.ToString(Session.Timeout * 60) + ";url=ViewSubject.aspx";
            this.Page.Header.Controls.Add(meta);
           

        }



  <sessionState mode="InProc" cookieless="true" timeout="1">
     
    </sessionState>





Friday, 9 November 2012

to edit,update in gridview

 <div>
        <asp:GridView ID="GridView1" runat="server" CellPadding="4" ForeColor="#333333" AutoGenerateColumns="False"
            GridLines="None" OnRowDataBound="GridView1_RowDataBound" OnRowCancelingEdit="GridView1_RowCancelingEdit"
            OnRowEditing="GridView1_RowEditing">
            <RowStyle BackColor="#EFF3FB" />
            <Columns>
                <asp:TemplateField HeaderText="Stateid">
                    <ItemTemplate>
                        <asp:Label ID="lblstateid" runat="server" Text='<%#Bind("Stateid") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="State">
                    <ItemTemplate>
                        <asp:TextBox ID="txtState" runat="server" Text='<%#Bind("State") %>'></asp:TextBox>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Location">
                    <ItemTemplate>
                        <asp:DropDownList ID="ddlcity" runat="server">
                        </asp:DropDownList>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:Button ID="btnEdit" runat="server" Text="Edit" CommandName="edit" />
                        <asp:Button ID="btndelete" runat="server" Text="delete" />
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:Button ID="btnUpdate" runat="server" Text="Update" OnCommand="Update" />
                        <asp:Button ID="btnCancel" runat="server" Text="Cancel" CommandName="Cancel" />
                    </EditItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField></asp:TemplateField>
            </Columns>
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <EditRowStyle BackColor="#2461BF" />
            <AlternatingRowStyle BackColor="White" />
        </asp:GridView>
    </div>

public void bindgridview()
    {
        con.Open();
        SqlCommand cmd = new SqlCommand("select Stateid,State from tbl_State", con);
        SqlDataAdapter sdp = new SqlDataAdapter(cmd);
        DataTable dt = new DataTable();
        sdp.Fill(dt);
        GridView1.DataSource = dt;
        GridView1.DataBind();
        con.Close();
    }
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
    {
        GridView1.EditIndex = e.NewEditIndex;
        bindgridview();
    }
    protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
    {
        e.Cancel = true;
        GridView1.EditIndex = -1;
        bindgridview();   
    }
    protected void Update(object sender, CommandEventArgs e)
    {
        con.Open();
        Button edit = (Button)sender;
        TextBox txtpackage = (TextBox)edit.FindControl("txtState");
        Label id = (Label)edit.FindControl("lblstateid");
        string query = "Update tbl_State set State=@State where Stateid=@Stateid";
        SqlCommand cmd = new SqlCommand(query, con);
        cmd.CommandType = CommandType.Text;
        cmd.Parameters.AddWithValue("@State", txtpackage.Text);
        cmd.Parameters.AddWithValue("@Stateid", id.Text);
        cmd.ExecuteNonQuery();
        con.Close();
        GridView1.EditIndex = -1;
        bindgridview();  

    }

protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)// method2
    {
        con.Open();
        TextBox txtpackage = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtState");
        Label id = (Label)GridView1.Rows[e.RowIndex].FindControl("lblstateid");
        string query = "Update tbl_State set State=@State where Stateid=@Stateid";
        SqlCommand cmd = new SqlCommand(query, con);
        cmd.CommandType = CommandType.Text;
        cmd.Parameters.AddWithValue("@State", txtpackage.Text);
        cmd.Parameters.AddWithValue("@Stateid", id.Text);
        cmd.ExecuteNonQuery();
        con.Close();
        GridView1.EditIndex = -1;
        bindgridview();
     
     

    }

    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) method 3
    {
        con.Open();
        GridViewRow row = (GridViewRow)((Button)e.CommandSource).NamingContainer;
        TextBox txtpackage = (TextBox)GridView1.Rows[row.RowIndex].FindControl("txtState");
        Label id = (Label)GridView1.Rows[row.RowIndex].FindControl("lblstateid");
        string query = "Update tbl_State set State=@State where Stateid=@Stateid";
        SqlCommand cmd = new SqlCommand(query, con);
        cmd.CommandType = CommandType.Text;
        cmd.Parameters.AddWithValue("@State", txtpackage.Text);
        cmd.Parameters.AddWithValue("@Stateid", id.Text);
        cmd.ExecuteNonQuery();
        con.Close();
        GridView1.EditIndex = -1;
        bindgridview();


}

Find Control or Datakeys on RowCommand Event of GridView : 

To Find Control onRowCommand Event in GridView there is no Simple Way But we can use simple technique to find control from GridView.
This Simple Technique is given as follows:
1. Create a object of GridViewRow from refrence of command source row.
For Eg: 
GridViewRow row = (GridViewRow)((LinkButton)e.CommandSource).NamingContainer; 

But keep in mind that which type of object control is you are using to call event in above code is LinkButton. But if You Calling Rowcommand event from Simple Button then You need to Write this:
GridViewRow row = (GridViewRow)((Button)e.CommandSource).NamingContainer;

2. After Creating Row Object You can simply find any control from Gridview using rowindex.
For Eg: 
Label LabelEmail = (Label)GridView1.Rows[row.RowIndex].FindControl("LabelEmail");

3. Finally You Can Access that Properties of that Control.
For Eg: 
LabelResult.Text = LabelEmail.Text; 

4. Same as Above You can also find Datakeys of gridview using GridViewRow rowindex.
For Eg: 
int code = Convert.ToInt32(GridView1.DataKeys[row.RowIndex].Values[0].ToString());