Skip to main content

Posts

Showing posts from April, 2012

Select a single radio button from a grid using javascript in ASP.NET

How to manage a radio button in a Gridview? I have tried to select a single radio button out of multiple radio buttons in a Gridview. You can perform this using two ways. The first one is to use server side code. Use checked change property of radio button and find out which radio button has raised the event? and select that radio button; and make others uncheck. You need to set the “AutoPostBack” property of radio button to true to handle “OnCheckedChanged” event. However, the another way to do is by using javascript. You need to write the following javascript in an aspx page where you are using your Gridview. function CheckOnOff(rdoId,gridName) {     var rdo = document.getElementById(rdoId);     /* Getting an array of all the "INPUT" controls on the form.*/     var all = document.getElementsByTagName("input");     for(i=0;i<all.length;i++)     {          /*Checking if it is a radio button, and also checking if the         id of that radio

Understanding ASP.NET AJAX UpdatePanel Triggers

Introduction Microsoft's ASP.NET technology brings an object-oriented and event-driven programming model and unites it with the benefits of compiled code. However, its server-side processing model has several drawbacks inherent in the technology, many of which can be addressed by the new features included in the Microsoft ASP.NET 3.5 AJAX Extensions. These extensions enable many new rich client features, including partial rendering of pages without requiring a full page refresh, the ability to access Web Services via client script (including the ASP.NET profiling API), and an extensive client-side API designed to mirror many of the control schemes seen in the ASP.NET server-side control set. This whitepaper examines the XML Triggers functionality of the ASP.NET AJAX UpdatePanel component. XML Triggers give granular control over the components that can cause partial rendering for

Background text from javascript

Changing Text Colors You can see the effects of these color settings and changes in the paragraph below by clicking the "Switch Colors" button. Here is a paragraph of text with foreground and background color settings. These settings are changed by clicking the following button. Figure 10-7. Switching foreground and background color styles. <script type="text/javascript"> function SwitchColors() { if (document.getElementById("PAR").style.color == "red") { document.getElementById("PAR").style.color = "white"; document.getElementById("PAR").style.backgroundColor = "red"; } else { document.getElementById("PAR").style.color = "red"; document.getElementById("PAR").style.backgroundColor = "white"; } } </script> <p id="PAR" style="border:solid 1; padding:10; color:red; background-color:white; font-size:12

Useful Visual Studio Shortcuts

1. Manage Visual Studio Ctrl + s S ave current file Ctrl + Shift + s S ave all files Ctrl + Shift + n Create n ew project Ctrl + o O pen file Ctrl + Shift + o O pen project Ctrl + Shift + a A dd item to project Esc Close menu or dialog Ctrl + p P rint Shift + Alt + Enter Toggle full screen mode Ctrl + f4 Close current tab Ctrl + f6 / Ctrl + Shift + f6 Go to next / go to previous window Ctrl + Tab , then Arrow keys Press and hold Ctrl + Tab , then using arrow keys gives a small task manager with all open files and views ---------------------------- 2. Bookmarks For keystrokes with two keys such as Ctrl + k + k , keep holding the Ctrl key until releasing the last key. Ctrl + k + k Toogle boo k mark Ctrl + k + n Goto n ext bookmark Ctrl + k + p Goto p revious bookmark Ctrl + Shift + k + n Goto n ext bookmark in folder Ctrl + Shift + k + p Goto p revious bookmark in folder Ctrl + k + w Put focus on bookmark

Visual Studio shortcut keys

General Shortcut Description Ctrl-X or Shift-Delete Cuts the currently selected item to the clipboard Ctrl-C or Ctrl-Insert Copies the currently selected item to the clipboard Ctrl-V or Shift-Insert Pastes the item in the clipboard at the cursor Ctrl-Z or Alt-Backspace Undo previous editing action Ctrl-Y or Ctrl-Shift-Z Redo the previous undo action Ctrl-Shift-V or Ctrl-Shift-Insert Pastes an item from the clipboard ring tab of the Toolbox at the cursor in the file and automatically selects the pasted item. Cycle through the items on the clipboard by pressing the shortcut keys repeatedly Esc Closes a menu or dialog, cancels an operation in progress, or places focus in the current document window Ctrl-S Saves the selected files in the current project (usually the file that is being edited) Ctrl-Shift-S Saves all documents and projects Ctrl-P Displays the Print dialog