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
Wednesday, July 15, 2009
To check Control Id which makes Postback in a page
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
