Posts

Showing posts from 2016

Display PDF Or Tiff Files In IFrame

How to  Display PDF Or Tiff Files In IFrame in Asp.net C# Example:  In this application how to display PDF or tiff files in IFrame in asp.net C# . First We have to Know about IFrame ,  The <iframe> tag specifies an inline frame. An inline frame is used to embed another document within the current HTML document. Please Click this link and Know About IFrame Before Using IFrame Tag . Mostly Iframe does not support to show the PDF files Or Tiff Files in Google Chrome and Firefox browsers,Only supports in IE Browser. For my Requirement in this application I want to show the PDF File in IFrame, which is in local shared folder (\\IPAddress\SharedFolder\Filename.PDF). I want to give this path to IFrame like  <iframe id="imgdisplay" src="" runat="server"> Mostly Browser Compatibility Issues for IFrame ,see below 1. In IE Browser, If we call this path in iframe src it will displays the PDF file. Ex: imgdisplay.at

Delete Empty Rows or Null Rows in Datatable in C#

How to Delete Empty Rows or Null Rows in Datatable Example:  In this application we can see how to Delete Empty Rows or Null Rows in Datatable. Mostly this issue comes from while uploading the excel(.xls,.xlsx) file data into your sql table through datatable in windows application or web application. In rare cases,we can see while getting data from excel to datatable it will copies the empty rows also. Below Code. C# public DataTable DeleteEmptyRowsFromDataTable(DataTable dt) { for (int i = dt.Rows.Count - 1; i >= 0; i--) { if (dt.Rows[i][1] == DBNull.Value) dt.Rows[i].Delete(); } dt.AcceptChanges(); return dt; }

How to Create Custom DialogBox using JQuery

Image
Example: In this application I will show you how to create Dialog box using  JQuery . Mostly we use JavaScript Default confirmation box for yes or no options.But we can't add another option into that Default Confirmation box in that requirement we want to create custom Dialog box. For my requirement I need three button Yes,No and Cancel Options in Dialog Box. Lets see how it possible with JQuery 1. Create a new webform with the name of 'UIDialog.aspx'. 2. Add a JQuery and Css plugins for custom Dialog Box below head tag. Please see in code. 3. Create a function in that I have three buttons in aspx page. Please see below code. <head runat="server">     <meta name="viewport" content="width=device-width, initial-scale=1">     <title>jQuery UI Dialog - Modal confirmation</title>     <link href="Css/styles.css" rel="stylesheet" type="text/css" />     <script type=&quo

Restrict Special Characters in Windows Application using c#

Image
Example : In this application it will remove all the special characters when we trying to copy paste the special characters. Lets see how it is possible with Copy,paste. Please follow these steps : 1. Create a New Windows Form with the name of 'Form1', and take one label with the name of 'lblName' and one textbox with the name of 'txtName' and one button with the name of 'btnValidate'. Please see below image. 2. Add a code in TextChanged event for that textbox. Here my textbox name is 'txtName' in that I have added a event like . private void txtName_TextChanged(object sender, EventArgs e) {       txtName.Text = RemoveSpecialCharacters(txtName.Text); } 3. In that event you observed method name of 'RemoveSpecialCharacters'.Basically it will remove all the special characters when you are copy paste in to the textbox.       private string RemoveSpecialCharacters(String inString)      

Allow Numbers After Decimal And Before In Jquery

Image
Example: In this function it will takes 10 digits before decimal and after decimal it will takes 8 digits. Lets see how it is possible in Javascript, if you want to change it in Jquery also Please follow these steps: 1. Create a textbox with the name of txtDecimal and add a event with the name of onkeypress to that textbox and give maxlength of that textbox. See below. <asp:TextBox ID="txtDecimal" runat="server" MaxLength="20" onkeypress="return CheckNumber(event,this.value)"></asp:TextBox> 2. Create a Javascript function with the name of CheckNumber in aspx page. <script type="text/javascript">         function CheckNumber(key, value) {             var dot= /[.]/g;             var whitespace = /^\S+$/;             var Minus = /[-]/g;             var keyCode = key.keyCode == 0 ? key.charCode : key.keyCode;             var ret = ((keyCode >= 48 && keyCode <= 57) || (keyCode == 45)

Restrict Special Characters Using JavaScript By Copy,Paste

Restrict Special Characters using copy,paste events in JavaScript. Please follow these steps: 1. Create a textbox with the name of txtValidation and add event by the name of onpaste to that textbox. <asp:TextBox ID="txtValidation" runat="server" onpaste="return Validate(this.value);"></asp:TextBox> 2. Create a Function to that event.  <script type="text/javascript">         function Validate(Value) {             var pastedData = window.clipboardData.getData('Text');             var reg = /^[a-zA-Z0-9 ]*$/             if (!reg.test(pastedData)) {                 alert('Not Accept Special Characters');                 return false;             }         }     </script> Some of the special characters are hidden when you copy,paste it will not visible. If you want to restrict those special characters in sql database only, not in application. These Special Characters is not visible whe