UltraWebGrid Cell and CellItem

.Net No Comments »

if you have an UltraWebGrid with a TemplatedColumn, the TemplatedColumn has a checkbox or any other control. If you want to access the control inside that column here’s what you need to do:

  1. assuming you have a loop cycling through the rows
  2. Dim rw As UltraWebGrid.UltraGridRow = UltraWebGrid1.DisplayLayout.Rows(i)
  3. Dim cl As UltraWebGrid.UltraGridCell = rw.Cells.FromKey("myColumnName")
  4. Dim col As Infragistics.WebUI.UltraWebGrid.TemplatedColumn = cl.Column
  5. Dim ci As Infragistics.WebUI.UltraWebGrid.CellItem = col.CellItems(i)
  6. Dim chk As CheckBox = ci.FindControl("myCheckBoxID")

now you can access that checkbox and do whatever you want with it.

CSS float keep element inside DIV

HTML No Comments »

If you have come across the problem of containing floats, then there’s a simple fix to your problem. Typical scenario, you have an img tag (image) inside a div tag. The img is set to float (left of right), and the div tag is not big enough to contain all the img, so the img sticks out. The solution: hr tag at the bottom of the div tag, with the following CSS:

div.item hr { display: block; clear: left; margin: -0.66em 0; visibility: hidden; }

click here for more info

cell padding problem with older browsers

HTML No Comments »

I came across this problem with older browsers. If your table cell uses percentage for padding, for example:

<td style=”padding-right:1%”>text</td>

then that cell will expand off the screen.

Instead, use pixels for measurement, for example:

<td style=”padding-right:15px”>text</td>

Upload file timeout

.Net, ASP No Comments »

if your webpage submits a file for uploading, and the page returns an error on larger file sizes, then look for 2 attributes to modify in your web.config .

open you web.config file and seach for the following line:

<httpRuntime executionTimeout="480" maxRequestLength="7168"/>

executionTimeout is the time limit before the request timesout and you get an error, this figure is represented in seconds (480 = 8 minutes)
maxRequestLength is the file size represented in KB (1024 = 1MB, 7168 – 7MB)

for detailed info, go to: http://msdn.microsoft.com/en-us/library/e1f13641(VS.71).aspx

Retrieve column names from a table as a string

SQL No Comments »

DECLARE @c varchar(4000), @t varchar(128)
SET @c = ”SET @t=’authors’
SELECT @c = @c + c.name + ‘, ‘ FROM syscolumns c INNER JOIN sysobjects o ON o.id = c.id WHERE o.name = @t ORDER BY colid
SELECT Substring(@c, 1, Datalength(@c) – 2)

(you can replace this value ‘, ‘ above with any delimiter you choose like ‘-‘ or ‘;’ then update the -2 in the last line with the number of characters in your delimiter)

T-SQL replace part of a field

SQL No Comments »

Replace a word inside the values of a column:
 UPDATE YourTableName SET ColumnAffected =REPLACE(ColumnAffected,’old value’,’new value’) WHERE (ColumnAffected LIKE N’%old value%’)

T-SQL use CASE statement

SQL No Comments »

Select with CASE (SQL only)
 SELECT title, price, Budget =
   CASE price
          WHEN price > 20.00 THEN ‘Expensive’
           WHEN price BETWEEN 10.00 AND 19.99 THEN ‘Moderate’
           WHEN price < 10.00 THEN ‘Inexpensive’
           ELSE ‘Unknown’
          END, FROM titles

Connection Strings

.Net, ASP No Comments »

Access File:
 “Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Work\Tools\myaccessdb.mdb;”

SQL Server:
“user id=SqlLoginName;password=SqlPW;initial catalog=yourDBname;data source=YourServerName;Connect Timeout=30”

SQL – OLE DB:
 Data Source=ServerIP; User ID=SqlLoginName;password=SqlPW;initial catalog=yourDBname

CSV File:
 “Provider=Microsoft.Jet.OLEDB.4.0;Data Source=”c:\tool\myfile.csv”;Extended Properties=””text;HDR=No;FMT=Delimited”””

ODBC link:
 “DSN=myDB;UID=John;PWD=123;”

Download and install latest updates

Linux (Ubuntu) No Comments »

sudo apt-get update
sudo apt-get upgrade

Load Server Graphical Interface

Linux (Ubuntu) No Comments »

When I was new to Linux, I needed to use the graphical interface to perform regular management tasks. After installing Ubuntu 8.04, setup was complete and I was left with a command line interface. Now what?
Here is how I loaded the beautiful graphical interface (gnome):

sudo aptitude update
sudo aptitude install ubuntu-desktop

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in