Posts

Donate

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 }

Code In Gridview RowDatabound Not Working If Rowstate Is Alternate|Edit In ASP.NET Web Forms

In a gridview rowdatabound event I have this condition to check if rowstate is in edit mode: if (e.Row.RowState == DataControlRowState.Edit) //row is in edit mode { TextBox actdaterec = (TextBox)e.Row.Cells[1].FindControl( "txtDateRec" ); actdaterec.Text = string .Empty; TextBox cashRec = (TextBox)e.Row.Cells[2].FindControl( "txtCashReceived" ); cashRec.Text = string .Empty; } The code above usually works if the rowstate is in edit mode, however on the succeeding rows the rowstate becomes Alternate|Edit . The code above does not work. So the solution would involve C# bitwise operator (&) . See the revised code below: if ((e.Row.RowState & DataControlRowState.Edit) > 0) //row is in edit mode { TextBox actdaterec = (TextBox)e.Row.Cells[1].FindControl( "txtDateRec" ); actdaterec.Text = string .Empty; TextBox cashRec = (TextBox)e.Row.Cells[2].FindControl( "txtCashReceived"

Format Date Values Shown In Label Control Inside An ASP.NET Web Forms Gridview

Reference: Set Date Format in Gridview To format date as short date format of a label control inside a template field use Bind() as shown below: 1: <ItemTemplate> 2: <asp:Label id= "lblDateRec" runat= "server" Text= '<%# 3: Bind("GeneratedDateRec", "{0:MM/dd/yyyy}") %>' ></asp:Label> 4: </ItemTemplate>

Reset Autonumber Or Identity Column In Sql Server Transact SQL

Here is the script to reset autonumbers in sql server. Usually, i have to delete the table contents and then reseed the tables. TSQL Script: use Transmittal go delete from dbo.TransDetails; delete from dbo.TransMaster; DBCC CHECKIDENT (TransMaster, reseed, 0 ) DBCC CHECKIDENT (TransDetails, reseed, 0 )

Validation In ASP.NET WebForm Not Working For Confirm Dialog

In this scenario, I have a series of textbox controls that has required field validations and a save button with the following attribute property set in pageload event: btnSave.Attributes.Add( "onclick" , "return confirm ('Proceed saving or updating this record?')" ); In most cases, this works fine, but the problem is if i clicked ok in the confirm dialog of javascript, the validation of required fields will be bypassed. So the solution would be to modify the script to return false if cancel is pressed in the confirm dialog of javascript so that validation will work.Here is the modified script: btnSave.Attributes.Add( "onclick" , "if(!confirm ('Proceed saving or updating this record?')) return false;" ); If the user will click ok, in the javascript confirm dialog, validations will be executed.

How To Check if Leap Year In C#.NET

Hello, Below is a custom code i have been working to check if a year is considered as leap year. protected bool CheckLeap( int year) { if ((year%4==0&&year%100!=0)||year%400==0) { return true ; } return false ; } However, as i checked the DateTime class methods in MSDN, i found a handy tool to do the same functionality. DateTime.IsLeapYear( int year); Source Code: How To Check if Leap Year In C#.NET Cheers!

Donate