Posts

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',   ...

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' ;         ...

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...

Close The Reader First Problem in Asp.net When Read Data From SQL Server

Yesterday I was trying to fetch data from SQL server with the help of SqlDataReader but I got an error message " open DataReader associated with this Command which must be closed first " I search a lot on internet and got a solution regarding this problem. It was advised by someone that when you are reading data from server and trying to insert, delete or update action with the same connection then you will face such error which will told you to close the reader first. To get the solution for this problem you should do two things. 1. Use SqlDataAdapter and Fill command when you do not want to make an other connection for insertion and other things other than read. 2. use separate sql connection for insert, delete or update action. i.e when you have a SQL Connection 'Con' for reader. Then you should use other SQL Connection for other action. Someone also advised to add MultipleActiveResultSets=Truein connection string. Hope this will help you a lot...

Delete Duplicate Entry & Update Table By Copying Data From One Table to Other

Image
Suppose you want to take regular updates from various servers and store them in your own database for any valid reason. Then you will face problem of duplicate entry in your database. To understand this suppose you want to store various RSS Feeds news for further analysis then you will automatically refresh your page in certain time interval but in such situation your database will capture various duplicate entry also. To avoid such thing happen with you you will have to manage it will proper algorithm. Okay look at this technique and i hope this will help you a lot. 1. Take Two Table named as "FirstTable" and "SecondTable". Second Table will be your main table which stores actual data without duplicate entry. First Table will store updates only. 2. With the help of some logic we first take our updates first to "FirstTable" and then we will check weather "SecondTable" has same rows or columns. 3. If it has same rows and columns then delete...

Display RSS Feeds in Your Website & If Needed How to Store Them in DataBase

Image
RSS Feeds comes in the XML format and we all know that there is a start tag and other are child tag of start tag in XML format. You can read more about RSS Feeds and It's format or For simply overview you can read it from here. All the data comes in RSS Feeds like this- <rss version="2.0"> <channel>   -----   ----- <item>   ---   --- </item> </channel> </rss> to get the element inside RSS Feeds we will have to first select it's parent tag suppose..if we want title of any RSS then we will have to first select Channel tag the go to next step. like this.. XmlDocument doc = new XmlDocument (); doc.Load(" http://timesofindia.indiatimes.com/rssfeeds/1081479906.cms "); XmlNodeList a = doc.SelectNodes(" rss/channel/item ");  as from the above code it is clear that we are going to do some thing with inside the  <item></item> tag that's why we selected node with the help...

Upload and Display YouTube Video in Asp.Net

Image
In this tutorial I will teach you how to upload youtube video in database and display it in various style in web page in asp.net using C#. So, here we go... Make a database table with any name as you wish and give three column 1. ID which will be primary key and will auto increase. 2. UserID user name either from session or from simple inserting name every time when upload video. 3. VideoLink for storing video link from youtube page. YouTube video will not play on you web page until you convert it in embedded video so how to check which video is embedded and which one is not. look at the image   but when a user upload or share any youtube video he or she will not upload embedded video but he or she will upload simple URL of any video so we need to convert general URL in embedded URL by this way using C#. string s = TextBox1.Text string g = " embed/ ";         string o = " watch?v= ";       ...