You can do this in two way. One way is add primary key to your table. If try to add same value, it will refuse you.
Second way is before insertion you can get a select query to check whether there is a record same as you are trying to add or not?
In first solution as I remembered you should catch an exception.
To show your message you can use javascript alert.
By the way do not use this
SqlCommand cmd = new SqlCommand("INSERT into StudentDetailsTable (RollNo,StudentName,Standard,FathersName,MothersName,FamilyName,Location) VALUES ('" + TxtRollNo .Text + "','" + TxtStudentName .Text + "','" + TxtStandard .Text + "','" + TxtFathersName.Text + "','" + TxtMothersName.Text + "','" + TxtFamilyName.Text + "','" + TxtLocation .Text + "')", con);
Instead of this, you can use parameters. By using parameter you block all kind of sql injection.
Here is the explanation:
http://msdn.microsoft.com/tr-tr/library/system.data.sqlclient.sqlcommand.parameters.aspx[
^]