Wednesday, July 15, 2009

To check Control Id which makes Postback in a page

If you want to detect which control on a page occured Postback
You can get by this line in an CreateChildControls function

Dim ctrlName As String = Request.Params.Get("__EVENTTARGET")

Protected Overrides Sub CreateChildControls()
MyBase.CreateChildControls()

Dim ctrlName As String = Request.Params.Get("__EVENTTARGET")

End Sub

How to trigger a full postback from within an AJAX UpdatePanel

If you've ever used an AJAX UpdatePanel and needed to have a control within the UpdatePanel cause a full postback of the page, here's how you do it.

ScriptManager scriptManager = ScriptManager.GetCurrent(Page);
if (scriptManager != null)
{
scriptManager.RegisterPostBackControl(SaveButton);
}

First you have to get access to the ScriptManager on the page. Then you register the control within the UpdatePanel that needs to trigger a full postback.

setting a variable from dynamic sql

declare @i int
exec sp_executesql N'select @i = 999', N'@i int output', @i output
select @i


-- setting output parameter from dynamic stored procedure call

declare @OutputParameter varchar(100) ,
@error int ,
@SPName varchar(128) ,
@SPCall nvarchar(128) ,
@rc int
select @SPCall = 'exec ' + @SPName + ' @OutputParameter output'
exec @rc = sp_executesql @SPCall, N'@OutputParameter varchar(100) output', @OutputParameter output
select @Error = @@error

Thursday, February 19, 2009

Installing the Database using Aspnet_regsql.exe in vs2005

To run the Aspnet_regsql.exe wizard, run Aspnet_regsql.exe without any command line arguments, as shown in the following example:

C:\WINDOWS\Microsoft.NET\Framework\\aspnet_regsql.exe

Friday, January 23, 2009

Check PopUp blocker is enabled or not


FUNCTION IsPopupBlocker() {
   var oWin
= window.OPEN("""testpopupblocker""width=100,height=50,top=5000,left=5000";
  
IF (oWin==NULL || typeof(oWin)=="undefined" {
      
RETURN true;
  
} ELSE {
       oWin.
CLOSE();
      
RETURN false;
  
}
}

IF (IsPopupBlocker()) {
   document.write
("You HAVE A POPUP BLOCKER";
} ELSE {
   document.write
("Popup blocker NOT detected.";
}