Posts

Showing posts from April, 2009

How to hide generated javascript file in visual studio code

In this post I am going to show you a cool trick in visual studio code. Let's suppose you are writing typescript code in visual studio code and you want to hide generated javascript code.

Create .vscode folder in your folder and then create settings.json file and paste following code

{ "files.exclude": { "node_modules":true, "**/.git": true, "**/.DS_Store": true, "**/*.js.map": true, "**/*.js": {"when": "$(basename).ts"}     } }

How To Read xml using JQuery

Image
In this post i will show how to read xml using JQuery <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %><!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"><headrunat="server"><title></title><scriptsrc="Scripts/jquery-1.3.2.js"type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function() { $.get('Data.xml', function(d) { var data = ""; var startTag = "<table border='1' id='mainTable'><tbody><tr><td style=\"width: 120px\">Name</td><td style=\"width: 120px\">Link</td></tr>"…

jQuery Ajax call and result XML parsing in asp.net

Image
In this post i will show how to use Jquery in asp.net Start Microsoft Visual Studio .NET.On the File menu, point to New, and then click Project.In the New Project dialog box, click Visual C# ProjectsAdd a new xml file and copy the following xml.labels.xml<?xmlversion="1.0"encoding="utf-8"?><labels><labelid="1"><name>Test</name><address><street>street1</street><city>City1</city><province>ID</province></address></label><labelid='2'><name>Name2</name><address><street>Street2</street><city>City2</city><province>CT</province></address></label></labels> 5. Add a reference to the jQuery script6.Copy below code in aspx page.<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %><!DOCTYPEhtmlPUBLIC&quo…

How To Include Content of One Page To another Page

In this post i will show how to include the content of one page inside another using Regular expression . <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"><headrunat="server"><title></title></head><body><formid="form1"runat="server"><div><asp:LabelID="lblHtml"runat="server"></asp:Label></div></form></body></html>using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.IO; using System.Text.RegularExpressions; publicpartialclass _Default : System.Web.UI.Page { protectedvoid…

How To Select Value of gridview row using javascript

Image
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TestDDL.aspx.cs" Inherits="TestDDL" %><%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %><!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"><headrunat="server"><title></title></head><body><formid="form1"runat="server"><asp:ScriptManagerID="ScriptManger1"runat="server"></asp:ScriptManager><div></div><style> .invisibleColumn { display: none; width: 0px; } body { font-family: Arial; font-size: 12px; } </style><scripttype="text/javascript&q…

how to convert web page to pdf

Image
In this post i will show how to convert web page to pdf using iTextSharp. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Pdf.aspx.cs" Inherits="Pdf" %><!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"><headrunat="server"><title></title></head><body><formid="form1"runat="server"><asp:PlaceHolderID="PlaceholderPdf"runat="server"></asp:PlaceHolder><div><tableborder="1"><tr><tdcolspan="2"> aspdotnetcodebook </td></tr><tr><td> cell1 </td><td> cell2 </td></tr><tr><tdcolspan="2&qu…

ASP.NET and Ajax - using XmlHttpRequest

Image
In this post i will show how to use XmlHttpRequest object in asp.net.Here's an example that fetches the Product details by categoryid.Create a new web application and add following code on Default.aspx page( I have used Ajax.aspx). Ajax.aspx <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Ajax.aspx.cs" Inherits="Ajax" %><!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"><headrunat="server"><title></title><scripttype="text/javascript">function GetXmlHttpObject(handler) { var objXmlHttp = nullif (navigator.userAgent.indexOf("Opera") >= 0) { alert("This example doesn't work in Opera") return } if (navigator.userAgent.indexOf("MSIE") >= 0)…

How To Move Selected Record From One GridView to another

Image
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="MoveRecord.aspx.cs" Inherits="MoveRecord" %><!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"><headrunat="server"><title></title></head><body><formid="form1"runat="server"><div><asp:GridViewID="gridView1"runat="server"><Columns><asp:TemplateField><ItemTemplate><asp:CheckBoxID="chkSelect"runat="server"/><asp:HiddenFieldID="hdValue"runat="server"Value='<%#Eval("ID") %>'/></ItemTemplate></asp:TemplateField></Columns></asp:GridView></div><div><asp:ButtonID="btnMove"runat="server"Text="Move…

How To Extract Number from string

Image
In this post i will show how to extract number from string using Regular expression. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="ExtractNumber.aspx.cs" Inherits="ExtractNumber" %><!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"><headrunat="server"><title></title></head><body><formid="form1"runat="server"><div><asp:TextBoxID="txtInput"runat="server"></asp:TextBox><br/><asp:ButtonID="btnExtract"runat="server"Text="ExtractNumber"OnClick="btnExtract_Click"/><br/><asp:LabelID="lblMessage"runat="server"></asp:Label></div></form></body></html>using System; using System.…

How To create Cascade dropdownlist using asp.net callback.

Image
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AppCallBack.aspx.cs" Inherits="AppCallBack" %><!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"><headrunat="server"><title></title><scripttype="text/javascript">function ReceiveServerData(arg, context) { var cmd_content = arg.split(','); if (cmd_content[0] == 'LoadSubCategory') { document.getElementById('ddlSubcategories').innerHTML = cmd_content[1]; } else { document.getElementById('grvProducts').innerHTML = cmd_content[1]; } } function CallSrv(ddl) { if (ddl.id == 'ddlCategories') { if (ddl.value != 'Select') { …