Friday, April 23, 2010

T-SQL loop through all rows in a table to add an incremental value

DECLARE @tempTable table(Id INT NOT NULL PRIMARY KEY)
DECLARE @counter INT
INSERT INTO @tempTable SELECT UserId from TestTable
SET @counter = 1
WHILE (@counter < (SELECT COUNT(UserId) FROM @tempTable)+1)
BEGIN
UPDATE TestTable SET TestColumn = '' WHERE Id = (
SELECT a.Id FROM
(SELECT Id, Row_Number() OVER(ORDER BY UserId) AS 'RN' from TestTable) as a
where a.RN = @counter
)
SET @counter = @counter + 1
END

Wednesday, April 21, 2010

RadGrid wont expand after updated to Q1 2010

This is because the detail table is set to "visible=false" during the update process. Not all RadGrid controls in the application get this symptom, not sure why this happens. All you need to do is to change the setting to "visible = true"

Tuesday, April 20, 2010

T-SQL division

I came cross this this issue of failing to do a division with 2 integer values. Stupid enough......

so In order for the division to work i used CAST(value TO FLOAT)

Monday, April 19, 2010

Setup Radwindow on button in code behind

int tempId= 168;
RadWindow rw = rwmTEMP.Windows[0];
rw.Width = System.Web.UI.WebControls.Unit.Pixel(1000);
rw.Height = System.Web.UI.WebControls.Unit.Pixel(1000);
rw.Behaviors = WindowBehaviors.Move | WindowBehaviors.Close | WindowBehaviors.Maximize | WindowBehaviors.Resize;
rw.OpenerElementID = btnOpenWindow.ClientID;

rw.NavigateUrl = "~/xxxxx/abccc.aspx?TempId=" + tempId.ToString();

Thursday, April 01, 2010

add new line in ajaxToolkit:ConfirmButtonExtender's ConfirmText

use the combination of &,#,10, and ; to create a new line