Posts

Donate

How To Cast Numeric Numbers To Decimal Value Using Suffix In C#

Usually, i do decimal.parse(numeric value) to parse numbers to decimal. But there's a shortcut way to do this. Just append a suffix m or M to the numeric value. decimal balanceBank = 50000.5m; decimal balanceBank = 50000.5M; Source: MSDN

URL Rewritting Resolve URL In My External CSS And JavaScript Files

I have applied url rewritting from scott: URL Rewriting Tutorial to make my url's SEO friendly. However, my css and javascript files are created internally (w/ in the page itself). When i tried separating my css and .js files, I usually encountered javascript errors such as: 1. GetCustomerDetail is undefined [based from Mozilla Firebug] 2. Microsoft JS runtime error: object required [Internet explorer] I tried googling for hours about object required and have'nt found an answer. As i read again scott's article, the last paragraph was a hint regarding how to resolve CSS and image external links. The solution I came up with was using Control.ResolveUrl() so that my external javascript and css files will work. src= '<%= Page.ResolveUrl("yourjsfile")%>' 2: href= '<%= Page.ResolveUrl("yourcssfile")%>' A good resource, but haven't tested yet. Westwind Tutorial FROM MSDN: MSDN

Set Focus ASP.NET Web Forms Control Using Page Setfocus() Method

Hello, Most of the time, i usually have a JavaScript function to set focus a control during pageload. The control.focus() most of the time does not work in my asp.net page. But in an ASP.NET Page control, there is a handy method to focus. Page.Setfocus(Control.ClientID); where Control could be a textbox or button.

Highlight ASP.NET Web Forms GridView Row Using JavaScript

Here's the code on how to highlight an ASP.NET Web Forms GridView row using JavaScript. if (e.row.rowtype == DataControlRowType.DataRow) { e.Row.Attributes.Add( "onclick" , "document.getElementById('" + e.Row.ClientID + "') .style.backgroundColor = 'green';" ); }

Structures Example In C#.NET

Good evening team, Before migrating to .NET, i used to code a lot in C++/C.. One of the topics in data structures was structures .C# also has struct in its arsenal.A structure is similar to a class, but is a value type, rather than a reference type. Structures are declared using the keyword struct and are syntactically similar to classes. Here is the general form of a struct. struct name : interfaces { // member declarations } The name of the structure is specified by name.Structures cannot inherit other structures or classes, or be used as a base for other structures or classes. (Of course, like all C# types, structures do inherit object.) However, a structure can implement one or more interfaces. These are specified after the structure name using a comma-separated list. Like classes, structure members include methods, fields, indexers, properties, operator methods, and events. Structures can also define constructors, but not destructors. However, you cannot define a defaul

Format Width Of AutocompleteExtender AjaxControlToolkit

By default, the width of the autocomplete list of autocomplete extender is inherited from the target control which is the textbox. However, you can customize the width and appearance of the ajax control: 1. Create an asp.net website 2. Add a webservice to your site 3. In your webservice, add a code to retrieve customer or any info. 4. In your asp.net website, add an aspx markup similar below:  Note that CompletionListElementID target control is the div called autocomplete declared below the textbox. <asp:ToolkitScriptManager ID= "ToolkitScriptManager1" runat= "server" > <Services> <asp:ServiceReference Path= "~/YourSampleService.asmx" /> </Services> </asp:ToolkitScriptManager> <div> <table> <tr> <td><asp:TextBox ID= "txtName" runat= "server" ></asp:TextBox></td> <td><div id= "AutoComplete" runat= "server&q

How To Remove Autorun.inf Virus In USB 2.0 Flashdisk

I was bothered by this weird pop-up generated by avira antivirus regarding autorun.inf. After googling, the solution was to use cmd(previously DOS) command. del /a:rhs [driveletter] :autorun.inf Example: del /a:rhs F :autorun.inf (where F is my USB drive) Reference: http://inforids.com/remove-autoruninf-virus-completly-from-system-flash-drives/

SQL Server Formatting Dates Tip Or Article

Here is a handy site when im currently working with dates in sql server 2005/2008.. http://www.sql-server-helper.com/tips/date-formats.aspx

Simple WPF Datagrid Demo Or Tutorial

I have developed a project on WPF before. WPF has been utilized in Vista OS and other software. But this cannot replace the stability of Windows Forms. Still, I don't have ample time to dive deeply in WPF, hopefully soon! LOL.. :D So, to begin with: 1. Download and install WPF Toolkit (Visual Studio 2008) 2. Open Visual Studio 2008 3. Add a WPF Project (Just call it GridDemo) 4. Add a DataGrid in your Window.xaml 5. Make sure to have referenced wpf toolkit: http://schemas.microsoft.com/wpf/2008/toolkit/ 6. Customize Your Grid <grid:DataGrid AutoGenerateColumns= "False" Margin= "8,11,10,78" ItemsSource= "{Binding}" Name= "CusGrid" > <grid:DataGrid.Columns> <grid:DataGridTextColumn Binding= "{Binding Path=CustomerID}" Header= "Customer ID" /> </grid:DataGrid.Columns> ....other columns goes here </grid:DataGrid> 7. In your Window1.cs file, populate your gr

Using JQuery Intellisense In An External JavaScript File Of ASP.NET Web Forms

Create an aspx page and an external javascript file. Call the javascript external file in your aspx page. 1: <script src= "js/jquery-1.4.1.js" type= "text/javascript" > 2: </script> 3: <script src= "js/Sample.js" type= "text/javascript" > 4: </script> In your external .js file, add the following code on top of the js file page. ///<reference path="jquery-1.4.1.js"/> function dothis() { //your code here }

Donate