Tuesday, March 7, 2017

How to validate Summernote using javascript/jquery and reset the value

In this article I am going to show you how to validate and reset Summernote (To know more about summernote click on link). 

So, for this firstly we get the value of editor and store in a variable just like (Editor is id of summernote) :


   1:  var code = $('#Editor').summernote('code');
 
After this we replace symbols like <, >, /  with space ' ', because of the default value of summernote is '<p> <br/> &lt/;p>'
 Final code is :


   1:   var code = $('#Editor').summernote('code');
   2:          var filteredContent = (code).replace(/\s+/g, '');
   3:   
   4:          if (filteredContent.length == 0) {
   5:              $('.note-editable').css({ 'border': 'solid 1px red' }).focus();
   6:              //  if summernote is empty          
   7:              isValid = false;
   8:          }
   9:   

Now, for reset the summernote value :


   1:   $('#Editor').summernote('code', '');
 
I hope ,it will help you.

Thursday, March 2, 2017

How to fix header of table or gridview or datatable without using any plugin and without scroll in table


In this article I am going to tell how fix make table header freeze using javascript and CSS.

You can see live demo below

Name Phone Address
table1 data1 table1 data1 table1 data1
table1 data2 table1 data2 table1 data1
table1 data3 table1 data3 table1 data1
table1 data4 table1 data4 table1 data1
table1 data5 table1 data5 table1 data1
table1 data6 table1 data6 table1 data1
table1 data7 table1 data7 table1 data1
table1 data8 table1 data8 table1 data1
table1 data9 table1 data9 table1 data1
table1 data10 table1 data10 table1 data1
You can see above table header is freezed while we scroll down to the page. For this you have to set the header class 'floatingHeader' and gridview class 'persist-area"' of gridview/datagrid or any other table like :


   1:   <asp:GridView runat="server" HeaderStyle-CssClass="persist-header" CssClass="persist-area" ID="grdView">
   2:          <Columns>
   3:              <asp:TemplateField>
   4:                  <ItemTemplate></ItemTemplate>
   5:              </asp:TemplateField>
   6:              <asp:TemplateField>
   7:                  <ItemTemplate></ItemTemplate>
   8:              </asp:TemplateField>
   9:          </Columns>
  10:      </asp:GridView>

Then define floatHeader style like :

   1:   .floatingHeader {
   2:        position: fixed;
   3:        top: 0;
   4:        visibility: hidden;
   5:      }

Finally wirte javasctip code as below: In the below javascript code we are creating a clone of table header and show/hide on the event of scroll.


   1:  <script>
   2:   function UpdateTableHeaders() {
   3:         $(".persist-area").each(function() {
   4:   
   5:             var el             = $(this),
   6:                 offset         = el.offset(),
   7:                 scrollTop      = $(window).scrollTop(),
   8:                 floatingHeader = $(".floatingHeader", this)
   9:   
  10:             if ((scrollTop > offset.top) && (scrollTop < offset.top + el.height())) {
  11:                 floatingHeader.css({
  12:                  "visibility": "visible"
  13:                 });
  14:             } else {
  15:                 floatingHeader.css({
  16:                  "visibility": "hidden"
  17:                 });
  18:             };
  19:         });
  20:      }
  21:   
  22:      // DOM Ready
  23:      $(function() {
  24:   
  25:         var clonedHeaderRow;
  26:   
  27:         $(".persist-area").each(function() {
  28:             clonedHeaderRow = $(".persist-header", this);
  29:             clonedHeaderRow
  30:               .before(clonedHeaderRow.clone())
  31:               .css("width", clonedHeaderRow.width())
  32:               .addClass("floatingHeader");
  33:   
  34:         });
  35:   
  36:         $(window)
  37:          .scroll(UpdateTableHeaders)
  38:          .trigger("scroll");
  39:   
  40:      });
  41:  </script>
That's it finally you will get a table with freeze header:-).

Tuesday, February 28, 2017

Summernote not working or Icon not fully renderedd or css not working (Missing Editor Icons)

In my last article I have shown you how to use summernote using CDN. But when you download and use JS and css file to your local project folder then icon not display in editor something like :



This is because of the summernote css file is using font from CDN url  and not able to find path of that.So, to use summernote please make sure you are added all folder content to your project. you can download link from below :

http://summernote.org/getting-started/

OR

https://github.com/summernote/summernote/releases/download/v0.8.2/summernote-0.8.2-dist.zip

It would help you.

Monday, February 27, 2017

How to use HTML Editor (Summernote) in asp.net c#



In this article I am going to tell how to use HTMl editor in simple and easy way using Summernote super easy editor.


So, for this we need five plug-ins, I am giving CDN link below you can download from it.


After this,

First create a new project or website in Visual studio.

And add following code:



This will give the output some like  :







Most important line to add in your page directive is  :

 ValidateRequest="false" 

So, when you run this code and click on the save button you might be getting this error something like:

 
 To remove this error Add this in you web.config inside system.web tag:

Thursday, May 30, 2013

How to disable auto complete text from textbox in asp.net

How To Disable Auto Complete Text From Textbox

Some times for security purpose it is required to disable auto complete text from textbox. It also work on asp.net server tag.
To do it, In html Form tag have one property i.e. autocomplete. Set it to off. Like:

autocomplete="off"

Demo:

When autocomplete on:

   E-mail:

 


When autocomplete off:

   E-mail:

 

Saturday, February 16, 2013

Insert and search from database using WCF:


Insert and search from database using  WCF:
INTRO:
Windows Communication Foundation is an acronym of WCF.
Basically WCF is based on Service Oriented Architecture(SOA). It is a technology to develop applications that are based on SOA.

A WCF clients connect to WCF through an Endpoint. Endpoint contains Address, Binding, and Contracts. We can use ABC to remember these keywords.

Address:  Address denotes the address of WCF Service. The address contains  two elements: address of the  service and the transport protocol, used to communicate with the service. 

Binding: Binding denotes how communication done between service and client, means  what protocol is used  to  access the service. Protocols like HTTP, TCP, MSMQ  etc.

Contracts:  Contract means agreement between two parties . Similarly in WCF it is the agreement between client and service.  Contract defines what service does.  It have method definition and return type and data. Mainly it contains,
Service Contract
Operation Contract
Data Contract
Data Member

About Application: In this application you can add new student to database and search name using student id.
Lets Start:

Table name:  Student
Id is primery key (int)
Name is varchar(50)





To create WCF Service Firstly creates Interface that contains Service in IService1.cs:
 using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;

namespace WcfService2
{
    [ServiceContract]
    public interface IService1
    {
        [OperationContract]
        string setdata(student s);
        [OperationContract]
        student getdata(string nm, int i);
    }

    [DataContract]
    public class student {
          int _id;
          string _name;
       [DataMember]
        public int Id {
            get {
                return _id;
            }
            set {
                _id = value;
            }
        }
        [DataMember]
        public string Name {
            get {
                return _name;
            }
            set {
                _name = value;
            }
        }
    }
}


Now,  implement that interface in Service1.svc

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using System.Data.SqlClient;
using System.Configuration;

namespace WcfService2
{
  
    public class Service1 : IService1
    {
        string con = ConfigurationManager.AppSettings["con"];
        SqlConnection conn;
        public string setdata(student s)
        {
            try
            {
                conn = new SqlConnection(con);
                conn.Open();
 SqlCommand com = new SqlCommand("insert into student (name) values(@student)", conn);
 com.Parameters.AddWithValue("@student", s.Name);
 com.ExecuteNonQuery();
                return "inserted";

            }
            catch (Exception ex)
            {
                return ex.ToString();
            }
            finally {
                conn.Close();
           
            }
        }

        public student getdata(string nm,int id)
        {
            student s = new student();
            try
            {
                conn = new SqlConnection(con);
                SqlCommand com = new SqlCommand("select name from student where id=@id", conn);
                conn.Open();
                com.Parameters.AddWithValue("@id", id);
               
                SqlDataReader read = com.ExecuteReader();
                read.Read();
                s.Name = read[0].ToString();
                s.Id =Convert.ToInt32( id);
                return s;
            }
            catch (Exception ex)
            {
                s.Name = "no result found";
                return s;
            }
            finally {
                conn.Close();
            }

        }
    }
}





Then add new project in WCF service solution and  add new web application





Add following code in web form.aspx file inside form tag:
    Id<asp:TextBox runat="server" ID="sid">
    </asp:TextBox>
    <asp:Button ID="search" Text="search" runat="server" onclick="search_Click" /><br />

    <asp:Label runat="server" ID="name">
    </asp:Label><br />
    <asp:Label runat="server" ID="id"></asp:Label>

    </div>
    <hr />
    <br />
    Name<asp:TextBox ID="inm" runat="server"></asp:TextBox>
    <asp:Button ID="insert" runat="server" Text="insert" onclick="insert_Click" />
    <asp:Label runat="server" ID="res"></asp:Label>

Now ASP page looks like :



In code behind file add the following code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ServiceModel;
using WebApplication2.ServiceReference2;

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

        }

        protected void search_Click(object sender, EventArgs e)
        {

            Service1Client client = new Service1Client();
            student s = new student();
           s= client.getdata("",Convert.ToInt32(sid.Text));
           name.Text=s.Name;
            id.Text=s.Id.ToString();
           
        }

        protected void insert_Click(object sender, EventArgs e)
        {

            Service1Client client = new Service1Client();
          
            student s = new student();
            s.Name = inm.Text.ToString();
            string res=client.setdata(s);
            this.res.Text = res;

        }
    }



 You have to copy this line by right clicking on Service1.svc file and click on option View in Browser:           Service1Client client = new Service1Client();






Now, right click on Service1.svc file and click on option View in Browser:
And copy address





IN Web application right and select option ADD SERVICE REFERENCE






Paste copied address in new open small window like this and press GO button:



 
Now right click on webapplication and select set as startup project
Then  set  webform.aspx page as a start page and run project.



Saturday, August 4, 2012

Free downlad Java Project. Windows application[college library System]

Free downlad Java Project. Windows application[college library System]


Title of the project is "College Library System", As the name, it is a Library management system software for monitoring and controlling the transactions in a library. This is developed in Java so it is fully platform Independent . This project mainly focused on basic operations like adding new member or user, new Books, updation ,  deletion , searching books, members , taking books and returning books are the features of this projects. "College Library System"project is written for 32 bit based Operating Systems
, designed to maintained records in  library.

Steps to run project:

  • First extract the files in any folder.
  • Search the file named first.bat.
  • Double click on this file.
  • wait for a few seconds..

For any help or suggestion. Please  write in comments...


Some screenshots of this project: 




Admin Login Page



Admin Page after Login


Download Link: 


Click here for download...


Friday, February 24, 2012

Free download JSP Complete Reference book

JSP Complete Reference.

JSP is server side scripting language. JSP stands for Java server page. JSP is used for how to present web page to the users or on client side while Servlet is used for how to process data, what logic is used for passing and retrieving data from the client side, server side or from Database. JSP is used in between <%    %> tag . It is used inside the html tag. There are five types of JSP tags :
These are :
  • <%  script let  %>
  • <%-- comments  --%>
  • <%!   declaration    %>
  • <% @ page import =java.io.*     %>
  • <%  = Expression   %>

 JSP Complete Reference.

This is the best book for the beginner of JSP to help.For  Download click on link below :







 

Tuesday, October 25, 2011

Java Language Java.The.Complete.Reference.7th.Edition

Java Language

Java.The.Complete.Reference.7th.Edition



Java is high level Programming Language and Object Oriented. It has many features like it is simple (easy to learn),support object, Platform Independent, both compiler and Interpreter, robust, Distributed and many other features that makes java flexible and easy.    

Java The Complete Reference is the best book for the beginners who want to learn Java.
It covers the following topics :
    • The History and Evolution of Java
    • An Overview of Java
    • Data Types, Variables,and Arrays
    • Operators
    • Control Statements
    • Introducing Classes
    • A Closer Look at Methodsand Classes
    • Inheritance
    • Packages and Interfaces
    • Exception Handling
    • Multithreaded Programming
    • Enumerations, Autoboxing,and Annotations (Metadata)
    • I/O, Applets, and Other
    Topics
    • Generics
So download this book by clicking on the download link,


       


Java.The.Complete.Reference.7th.Edition

Click Here For Free Download...








For compile and running java programs you  must have Jdk and Jre.
 





Wednesday, October 19, 2011

watch tv channels online

watch tv channels online (updated list) 
Now you can watch your favorite tv episodes, news,cartoon, Movies and so many things that you want to watch on tv but due to some reason(you don't have tv , cable etc.) you are not able to watch them.Many website allow you to watch online tv without any cost. List of them are :

Watch Aaj tak live: https://www.youtube.com/watch?v=oMETNh3Tr0Q
Watch live 9xm music channel: http://www.9xm.in/?page_id=304 
Watch NDTV live : http://www.ndtv.com/video/live/channel/ndtv24x7
Watch Zoom Tv live : http://www.zoomtv.com/zoom-tv 
Watch Zee News live : http://zeenews.india.com/live-tv 
Watch Abp News live : http://www.abplive.in/live-tv  

So watch and enjoy...

Friday, March 18, 2011

NEED FOR SPEED HOT PURSUIT DOWNLOAD

NEED FOR SPEED HOT PURSUIT DOWNLOAD 
DOWNLOAD LINK:

DOWNLOAD FREE c++(CPP) by balaguruswamy

DOWNLOAD FREE c++(CPP) by balaguruswamy

This is best book for c plus plus beginners . downwnload link :
click here for download..

Sunday, October 17, 2010

Trick to win Windows XP Solitaire game

Trick to win Windows XP Solitaire game

 If you want to win solitaire game with in seconds then I am going to tell you how to win .
First open the solitaire game.
In the game window press the button Alt+Shift+2
Now you can see this :

 So, enjoy it !

Send free sms from pc to mobile in India or world without Registration and free

Send free sms to mobile in India or world without Registration

Now,  you can send free sms to mobile in india without any registration. 

First, select the destination where you want to send sms.



 Then, write message, sender mobile no. and your name then click on the send button.
When your message has been sent then ' your message has been sent' message will display in yellow box.. 
So, Send 10 sms absolutely free per day..

Related Posts Plugin for WordPress, Blogger...