Posts

Showing posts from September, 2013

Count function of SQL to count entries of various types saperately

Image
Suppose you have a table 'A' in which you have '5' or many more categories and for the same type category you have many entries. Take an example where you want to count no of employes in corresponding departments and want to display them in web page. How you will do it in Asp.Net? I did that with the help of Grid View. I took a Grid View take two columns and used following SQL Query: Select Department, Count(Name) as Emp_Name from table name group by Department having(Count(Name)>1) By this way you can easily get No of employes in corresponding departments.

Insert Data In SQL Data Base using Jquery in Asp.Net

To make you understand take a small example. Suppose we want to make a simple signup form (in which we will not check similar username or duplicate user name; I hope you can easily do it). So make a table with two columns 'UserID' and 'Password'. Take three text box one for username and other two to match and insert password (You can use java script to match password; I am not including it here). A button which will insert data in data base after clicking it. Write this code after closing form tag and just above closing of body tag. <script type="text/javascript">         $(document).ready(function () {             $("#Button1").click(function () {                 $.ajax({                     type: 'post',                     contentType: " application/json; charset=utf-8",                     url: ' datainsertunsingjquery.aspx/InsertMethod ',               // Here InsertMethod is a function on page name datains

How to Hide Buttons On Hardcopy of Printed Page and also Hide URL and Date

Image
To hide URL and date in hard copy of printed page you should do some setting in your browsers as it's setting changes according to various browsers. First look at Firefox so do it according to this. Go > Page setup > Select Margin & Header footer and make all field blank according to your requirment. In Chrome after giving print command do following If you want to hide buttons on printed page then in you javascript code you should hide all buttons after giving print command so do it as  <script type= "text/javascript" >         function printpage() {              var a = document.getElementById( "Button1" );             var b = document.getElementById( "Button2" );             a.style.visibility = 'hidden' ;             b.style.visibility = 'hidden' ;             window.print()         } </script> And in your button give command like this.. < asp:Button class=" button " ID=" Butt

Pass Value From One Web Page To Another in Asp.Net

Image
Suppose there is a scenario in which you want when you click on some text then associated value should pass to another page and with the help of this associated value you can do anything. That link my be simply in paragraph or in Grid View or in Data list. There may be many methods to do it and I hope one of them called 'Session' be in you knowledge. But doing this with help of session is not considered good so here we will use other technique as well.. Suppose you have Page 'a.aspx' and other page 'b.aspx' you want to pass value from one to another then on first page write this code but before this suppose you have a link button on click of this associated value will pass to 'b.aspx'. code on click event of link button in 'a.aspx' Response.Redirect(" b.aspx?value= " + here you should write variable of reference variable); Response.Redirect(" b.aspx "); on the page 'b.aspx' of page load event write following c