Posts

Showing posts from February, 2014

Donate

Set GridView Lines And Pager Background Color In ASP.NET Web Forms

Usually, in ASP.NET 2.0, setting the GridView lines through property should work. However in 4.5, it doesn't seem to render correctly. One blog pointed out to set the gridlines through it's row data bound property as demonstrated on the code below: Aspx Markup <asp:GridView ID= "GridView1" runat= "server" DataSourceID= "SqlDataSource1" BorderColor= "Black" BorderStyle= "Solid" PageSize= "2" AllowPaging= "True" OnRowDataBound= "GridView1_RowDataBound" BackColor= "White" CellPadding= "3" > <FooterStyle BackColor= "White" ForeColor= "#000066" /> <HeaderStyle BackColor= "#006699" Font-Bold= "True" ForeColor= "White" /> <PagerStyle BackColor= "White" ForeColor= "#000066" HorizontalAlign= "Justify" Wrap= "True" ...

Add Connection On Data Source Controls Not Loading SQL Server 2012 Server Or Instance Name

Image
After installing SQL Server 2012 Developer Edition SP1 on my other laptop, I tried creating an ASP.NET app using SQL DataSource control as the datasource control of the GridView. But to no avail, the mssql server instance doesn't load on the server name dropdown contol as shown below: The hardware specifications are as follows: Windows 8 Pro, Visual Studio 2008/2010/2012 and SQL Server 2012 Developer Edition SP1. However, on my other laptop which has a Windows 8.1 OS, the server names were loaded on the Server Name dropdown control. After experimenting for a few hours, I discovered a simple solution which is to Turn Off The Windows Firewall . After that, my sql server instance is loaded on the control as shown below: Cheers!

'Microsoft.VisualStudio.Editor.Implementation.EditorPackage' package did not load correctly (Visual Studio 2012)

After installing updates for my Windows 8 laptop, I did a restart and opened a Visual Studio 2012 instance. Surprisingly, an error pops-up as stated by the title of this  Post. I did some search on Microsoft Knowledge Base and found a patch for it which is available for download. See the link below: Update for Microsoft Visual Studio 2012 (KB2781514) Greg

CSS Linear Gradients Not Working In Internet Explorer 9 But Working In Firefox And Chrome

Image
I came across with linear gradients not working correctly in IE 9. One solution suggested by a popular forum is to utilize an image as the background of a particular element. Since I'm not a graphic designer, I searched for other solution. I came up with an alternative which is to embed an svg file instead of an image file as an element's background. The css code below won't work in IE 9. body { background-image : -ms-linear-gradient( top , #000, #666); } Here's a solution using .svg file: <svg xmlns= "http://www.w3.org/2000/svg" width= "100%" height= "100%" viewBox= "0 0 1 1" preserveAspectRatio= "none" > <linearGradient id= "g762" gradientUnits= "userSpaceOnUse" x1= "0%" y1= "0%" x2= "0%" y2= "100%" > <stop stop-color= "#000000" offset= "0" /><stop stop-color= "#666666" o...

Creating And Consuming Custom Control Events In Windows Forms C#

In my autocomplete textbox control, I have a listbox that shows the suggested items based on user input. However, as a requirement I want to create an event that will trigger once a selection has been done in the listbox and this event will be consumed in the calling program (Main Form). To do that, you must define a custom event. After googling for a while, here are the references that made me accomplish the task: Creating Custom Events in C# Quick and Easy Custom Events Cheers!

Change WPF DataGridCell Background Color Using IVMultiValueConverter

Image
In a post by codefornothing in which He demonstrate the use of IMultiValueConverter using DataTable: The WPF Datagrid and Me , I decided to create a similar post in which the binding source is of type collection (Observable Collection). I encountered a few issues like how to replace the Binding Path values from binding to a strongly type class instead of DataTable. To get things started, here are the snippets: Observable Class public class StudentList : ObservableCollection<Student> { public StudentList() { Add( new Student{ID = 1, Age = 29, Name = "Jerby" , Address= "Cebu" }); Add( new Student{ID = 2, Age = 28, Name = "Renz" , Address= "Cebu" }); Add( new Student{ID = 3, Age = 23, Name = "Aya" , Address= "Leyte" }); Add( new Student{ID = 4, Age = 33, Name = "Jeff" , Address= "Leyte" }); Add( new Student{ID = 5...

Change WPF DataGridCell Background Color Using IValueConverter

Image
Here's a solution in painting a specific DataGridCell using IValueConverter. The datagrid set's it's ItemSource property either using List object or Datatable object. Resource markup: <Window.Resources> <src:BorderBrushConverter x:Key= "BorderBrushConverter" /> </Window.Resources> XAML markup: <DataGrid AutoGenerateColumns= "False" CanUserAddRows= "False" Grid.Row= "2" Grid.Column= "0" Name= "dgStudents1" > <DataGrid.Columns> <DataGridTextColumn Header= "ID" Binding= "{Binding Path=ID}" Width= "120" IsReadOnly= "True" /> <DataGridTextColumn Header= "Age" Binding= "{Binding Path=Age}" MinWidth= "100" IsReadOnly= "True" > <DataGridTextColumn.CellStyle> <Style TargetType= "DataGridCell"...

Change WPF DataGridRow Background Color Using IValueConverter

Image
There are several ways in painting a wpf datagrid. One option would be to use the IValueConverter interface. Firstly, you have to define a class that implements the interface. And add contracts to Convert() and ConvertBack() methods. Assuming in your form load, you bind a List object to the datagrid's ItemSource property. T could be a pre-defined class. Here's the Resource code: <Window.Resources> <src:AgeTargetConverter x:Key= "AgeTargetConverter" /> </Window.Resources> Here's the XAML markup: <DataGrid Grid.Row= "0" Grid.Column= "0" AutoGenerateColumns= "False" CanUserAddRows= "False" Name= "dgStudents" > <DataGrid.RowStyle> <Style TargetType= "{x:Type DataGridRow}" > <Style.Triggers> <DataTrigger Binding= "{Binding Age, Converter={StaticResource AgeTargetConverter}, ConverterP...

Windows Forms Fire TextBox Control Events Defined In A User Cntrol From Main Form

In a scenario where in I have created a user control which has a textbox control with private keypress event. I drag and drop the user control to my main form and then I want to fire the keypress event defined in the user control. Assuming in my main form I have this code: private void customTextBox1_KeyPress_1( object sender, KeyPressEventArgs e) { //accept letters,numbers, spacebar and backspace key if ( char .IsLetterOrDigit(e.KeyChar) || e.KeyChar == '\b' || e.KeyChar == ( char )Keys.Space) { e.Handled = false ; } else { e.Handled = true ; } } Note: customTextBox1 is the user control name and customTextBox1_KeyPress_1 is the user control keypress event. In order to trigger the keypress event of the textbox defined in the user control, call Keypress user control in the textbox keypress event handler. See code below: private void textBox1_KeyPress( object sende...

Apply Drop Shadow Effect To Text Using CSS (Cross Browser Compatibility Issue)

Image
Out of boredom, I tried manipulating the drop shadow effect of text in a simple html file. The browsers tested where IE 9, Firefox 12 and Chrome version 32.However, I found some difficulties on controlling the drop shadow effect in IE 9. After doing some research, I found a solution using filter. Here's my simple html markup: <!DOCTYPE html> <html> <head> <meta charset= "utf-8" /> <title>Chapter 2: Drop shadows on text</title> <link rel= "stylesheet" href= "textshadowGreg.css" /> <!-- http://reference.sitepoint.com/css/conditionalcomments --> <!--[if IE ]> <link href="textshadowIE.css" rel="stylesheet" type="text/css"> <![endif]--> </head> <body> <h1>What is CSS?</h1> <p> Cascading Style Sheets (CSS) is a style sheet language used for de...

Donate