Posts

Formating Date Time In Asp Dot Net

Format Code Short date pattern (d) DateTime.Now.ToString("d") Long date pattern (D) DateTime.Now.ToString("D") Full date/time pattern - short time (f) DateTime.Now.ToString("f") Full date/time pattern - long time (F) DateTime.Now.ToString("F") General date/time pattern - short time (g) DateTime.Now.ToString("g") General date/time pattern - long time (G) DateTime.Now.ToString("G") Month/day pattern (M) DateTime.Now.ToString("M") Round-trip date/time pattern (O) DateTime.Now.ToString("O") RFC 1123 pattern (R) DateTime.Now.ToString("R") Sortable date/time pattern (s) DateTime.Now.ToString("s") Short time pattern (t) DateTime.Now.ToString("t") Lon...

Full Code For Login With Remember Me In Asp.Net C#

Image
Here i am going to  tell you how to create login page with remember me checkbox with simple code, remember me checkbox will keep username and password for user to login next time without putting user id and password Here is aspx page and codebehind code with database. .aspx page code < div class ="sign-in-form"> < asp : TextBox TextMode ="Email" ID ="txtemail" runat ="server" class ="form-box required" placeholder ="Email Address" required ></ asp : TextBox > < asp : TextBox ID ="txtpassword" TextMode ="Password" runat ="server" class ="form-box required" placeholder ="Password" required ></ asp : TextBox >                                     < div class ="sign-in-settings"> < input runat ="server" id ="chkrembr...

Replace All Special Characters with Underscore Or Space in asp.net c#

Simple method to replace all the special characters with underscore or space. Here is the code, while inserting data you can replace characters with this code step. cmd.Parameters.AddWithValue( "@column_name" , Regex .Replace(txt_hedng.Text, "[^a-zA-Z0-9]+" , "_" )); Another Example   string   quote = "being #cool is so difficult !!" ; string  replace =  Regex .Replace( quote ,  "[^a-zA-Z0-9_]+" ,  " " ); Output being cool is so difficult

display numbers of rows, index data Container.ItemIndex in listview asp.net c#

Insert This code in listview it will index data and will display numbers on all rows like if you have row one there you can see a number 1 in first row then on second row 2. <%# Container.ItemIndex + 1 %>

how to create dynamic social sharing link in asp.net c#

Create dynamic social sharing link in asp.net c# using this code. by below code you can create any social links..  put this code on page load or however you want to use. facebook.HRef= "https://www.facebook.com/sharer/sharer.php?u=" + Request.Url.AbsoluteUri; twitter.HRef = " https://twitter.com/home?status=" + Request.Url.AbsoluteUri; google_plus.HRef= "https://plus.google.com/share?url" + Request.Url.AbsoluteUri; linkedin.HRef = "https://www.linkedin.com/shareArticle?mini=true&url"   + Request.Url.AbsoluteUri;

Find Label Control In Listview asp.net c#

< asp : ListView ID ="ListView1" runat ="server" OnItemDataBound ="databound_ListView1" > < ItemTemplate > < asp : Label ID ="lbldatetime" runat ="server" text =' <% # Eval("DateTime") %> '></ asp : Label > </ ItemTemplate > </ asp : ListView > protected void databound_ListView1( object sender, ListViewItemEventArgs e)         {             Label dt;             if (e.Item.ItemType == ListViewItemType .DataItem)             {                 dt = ( Label )e.Item.FindControl( "lbldatetime" );                 DateTime date = Convert .ToDateT...

Time Ago in asp.net c#

Image
TimeAgo Like facebook using asp.net c# . Displaying date in timeago format under Listivew in Label control. Below is the code:    < asp : ListView ID ="ListView1" ClientIDMode ="Static" runat ="server" OnItemDataBound ="databound_ListView1" > < ItemTemplate >         < div class ="col-sm-12">     < span class ="hidden"> <% # Eval( "id" ) %> </ span >      < b > <% # Eval( "Name" ) %> </ b >      < asp : Label ID ="lbldatetime" runat ="server" text =' <% # Eval("DateTime") %> '></ asp : Label >     </ div >      </ ItemTemplate > </ asp : ListView > aspx.cs code public static string TimeAgo( DateTime date)         {             TimeSpa...