Showing posts from March, 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, "**/*": true, "**/*.js": {"when": "$(basename).ts"}     } }

Parent Child Relationship in Javascript

In this post i will show how to call parent window function from child window and how to pass value from child window to parent window. Parent.aspx <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Parent.aspx.cs" Inherits="Parent" %><!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN"""><htmlxmlns=""><headrunat="server"><title></title><scriptlanguage="Javascript"type="text/javascript">function CallAlert() { alert("This is parent window's alert function."); } function ButtonClickByChild() { alert("Click by child."); } var newwindow; function poptastic(url) { newwindow =, 'name', 'height=400,width=700'); if (window.focus) { …

How To Create Composite Control

ASP.NET includes the TextBox control and the Validation controls which can be combined together to perform user input validation. The restriction is that the developer has to use two different controls to perform a simple validation. In this post are going to create a custom TextBox control which will use Required field validation controls and reduce the complexity of using multiple controls. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.ComponentModel; using System.Web.UI; using System.Web.UI.WebControls; namespace AspTextBox { [DefaultProperty("Text")] [ToolboxData("<{0}:AspTextBox runat=server></{0}:AspTextBox>")] publicclass AspTextBox : CompositeControl, INamingContainer { private TextBox _myTextBox = new TextBox(); private RequiredFieldValidator _myRFV = new RequiredFieldValidator(); protectedoverridevoid OnInit(EventArgs e) { base.OnInit(e); …

How To find control inside EmptyTemplate

In this post i will show . How to add new row in gridview. How to find control inside EmptyDataTemplate <%@ Page Language="C#" EnableEventValidation="false" AutoEventWireup="true" CodeBehind="Gridview.aspx.cs" Inherits="JQueryTest.Gridview" %><%@ Register Src="Grid3S.ascx" TagName="Grid3S" TagPrefix="uc1" %><!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN"""><htmlxmlns=""><headrunat="server"><title></title></head><body><formid="form1"runat="server"><div><asp:GridViewID="grdPrice"DataKeyNames="ID"runat="server"AutoGenerateColumns="False"Width="200px"ShowHeader="False"OnRowCommand="grdPrice_RowCommand"OnRowDataBoun…

jQuery in 15 minutes

Check out this SlideShare Presentation: jQuery in 15 minutesView more presentations from simon.

How To Create MultiColum Dropdownlist using DropDownExtender Control

<%@ Page Language="C#" AutoEventWireup="true" EnableEventValidation="false" CodeFile="MultiColumnDDL.aspx.cs" Inherits="MultiColumnDDL" %><%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %><!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN"""><htmlxmlns=""><headrunat="server"><title></title><style> .invisibleColumn { display: none; width: 0px; } body { font-family: Arial; font-size: 12px; } </style></head><body><formid="form1"runat="server"><asp:ScriptManagerID="ScriptManager1"runat="server"></asp:ScriptManager><div><asp:UpdatePanelID="…

How To Create Multi Column Dropdownlist

In this post i will show how to create multi column dropdown list using .In your server side code, use the \u00A0 character as your padding character. Create calculated columns in your data table to set as the text field for the dropdownlist.<%@ Page Language="C#" AutoEventWireup="true" CodeFile="MultiCoulmn.aspx.cs" Inherits="MultiCoulmn" %><!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN"""><htmlxmlns=""><headrunat="server"><title></title></head><body><formid="form1"runat="server"><div><asp:DropDownListID="ddlUser"runat="server"></asp:DropDownList></div></form></body></html>using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.W…

How To Create control at runtime using javascript

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AddRemoveJavascript.aspx.cs" Inherits="AddRemoveJavascript" %><!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN"""><htmlxmlns=""><headrunat="server"><title></title><scripttype="text/javascript">function addElement() { var ni = document.getElementById('myDiv'); var numi = document.getElementById('theValue'); var num = (document.getElementById('theValue').value - 1) + 2; numi.value = num; var newdiv = document.createElement('div'); var divIdName = 'my' + num + 'Div'; newdiv.setAttribute('id', divIdName); newdiv.innerHTML = "Element Number " + num + &quo…

How to Move a Text Box on Button Click

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN"""><htmlxmlns=""><headrunat="server"><title></title><scripttype="text/javascript">function moveTextBox() { var objTextbox = document.getElementById("theText"); += 100; } </script></head><body><formid="form1"runat="server"><div><inputid="Button1"style=""type="button"value="Button"onclick="moveTextBox()"runat="server"/><inputstyle="left: 166px; position: absolute; top: 98px"id="theText"type="text"/></div>&…

How To attach event to runtime created control

In this post i will show how to create control at run time and attached event to control. <!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN"""><html><head><title>Untitled</title></head><body><scripttype="text/javascript">function addRow() { var table = document.getElementById('table1'); var TR = table1.insertRow(); var TD = TR.insertCell(); TD.innerHTML = 'Row added'; TD.onclick = function() { alert('This is onclick') }; TD.onmouseover = function() { alert('This is mouseover') }; } </script><tableid='table1'></table><br><inputtype='button'value='Add Row'onclick='addRow()'/></body></html>

How To Find Position of Span Tag

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN"""><htmlxmlns=""><head><title></title><scripttype="text/javascript">function whereAmI( oLostObject ) { var iOffsetTop = 0; var iOffsetLeft = 0; while( oLostObject.parentNode ) { iOffsetTop += oLostObject.offsetTop; iOffsetLeft += oLostObject.offsetLeft; oLostObject = oLostObject.parentNode; } var sCoordinates = ( iOffsetLeft + "," + iOffsetTop ); alert( sCoordinates ); return sCoordinates; } </script></head><body><divstyle="text-align:right"><divstyle="padding:50px"><spanstyle="positiosn:absolute; top 50px; left:100px;"onmouseover="whereAmI( this )">I am Here.</span><…

How To add event to runtime created control -Javascript

<html><head><title>Untitled</title></head><body><script>function addRow(){ var table = document.getElementById('table1'); var TR = table1.insertRow(); var TD = TR.insertCell(); TD.innerHTML = 'Row added'; TD.onclick= function(){ alert( 'This is onclick') }; TD.onmouseover= function(){ alert( 'This is mouseover') }; } </script><tableid='table1'></table><br><inputtype='button'value='Add Row'onclick='addRow()'></body></html>

How To Display Hierarchical Data in the DropDownList

In this Post I will demonstrate how you can use a simple ASP.NET DropDownList control to display hierarchical data. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default6.aspx.cs" Inherits="Default6" %><!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN"""><htmlxmlns=""><headrunat="server"><title>Untitled Page</title><styletype="text/css"> .ParentChild { color:red; } </style></head><body><formid="form1"runat="server"><div><div><asp:DropDownListID="ddlCategories"runat="server"OnPreRender="ddlCategories_PreRender"/><asp:RequiredFieldValidatorID="rfvCategories"runat="server"ControlToValidate="ddlCategories"In…

Real World GridView: Excel-like Frozen Headers for ASP.NET 2.0

Check out this link for how to create Excel like gridview Link

GridView Sorting And Paging

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default4.aspx.cs" Inherits="Default4" %><!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN"""><htmlxmlns=""><headrunat="server"><title>Untitled Page</title></head><body><formid="form1"runat="server"><div><asp:GridViewID="GridView1"runat="server"AllowPaging="True"AllowSorting="True"AutoGenerateColumns="true"OnDataBound="GridView1_DataBound"OnPageIndexChanging="GridView1_PageIndexChanging"OnSorting="GridView1_Sorting"><PagerTemplate><asp:ButtonID="btnFirst"runat="server"Text="<< First"CommandArgument="First"CommandName="Page"/><asp…

How to create a Setup project for a Windows Service in Visual Basic .NET or in Visual Basic 2005

This article discusses how to create a Setup project for a Windows Service application. (Windows Service was formerly known as "NT service.") To do this, you must first create a solution that contains a simple Windows Service project. This project writes an entry to the application log. You then add a Setup project to the solution to install the Window Service. Finally, you start the service from within Visual Studio .NET Server Explorer. check out this link

101 LINQ Samples

if you're learning or curious about LINQ, MSDN has put together 101 LINQ samples to demo its core features. check out this linq 101 LINQ Samples

How to open ModalPopup inside ModalPopup

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Modal.aspx.cs" Inherits="Modal" %><!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN"""><htmlxmlns=""><headrunat="server"><title>Untitled Page</title><styletype="text/css"> .modalBackground { background-color:#f5f5f5; filter:alpha(opacity=80); opacity:0.7; } </style></head><body><formid="form1"runat="server"><asp:ScriptManagerID="A"runat="Server"></asp:ScriptManager><%--Master Button--%><asp:ButtonID="btnOpen"Width="200px"runat="server"Text="Open Parent"CssClass="button"CausesValidation="False"OnClientClick="$find('mdlPopup').show(); return false;"/&g…