The control that triggered the UpdatePanel controls to refresh
am 17.01.2008 18:09:03 von Kika
Hi All,
On my page, I have a custom control in which asp server controls can be
added and a UpdatePanel to notify the server of any edit in progress in the
custom control...I would like to know which server control triggered the
postback whitin my custom control. Currently, my customControl is declared as
follow:
runat="server" DisabledStateControlId="Button1"
OnUpdateOccured="UpdateInProgressPanel1_UpdateOccured">
and the following events will trigger a postback:
document.onchange = handleEvent;
interceptor.onclick = handleEvent;
interceptor.onkeypress = handleEvent;
interceptor.onkeydown = handleEvent;
interceptor.onpaste = handleEvent;
My problem is that after postback, I would like to set the focus on the
control which triggered the post back. So far, I have used the following:
string ctrlname = page.Request.Params.Get("__EVENTTARGET");
and
if
(((ScriptManager)this.Page.FindControl("ScriptManager1")).Is InAsyncPostBack)
fromWhere =
this.Page.Request[((ScriptManager)this.Page.FindControl("Scr iptManager1")).ID];
in order to get the control but i am always getting the custom control. I
want to associated postback events to the custom control only but would like
to know which control within it originated the postback...
Any help will be appreciated.
Thanks,
Kika
Re: The control that triggered the UpdatePanel controls to refresh
am 17.01.2008 20:56:05 von younlaot
On Jan 17, 12:09 pm, Kika wrote:
> Hi All,
> On my page, I have a custom control in which asp server controls can be
> added and a UpdatePanel to notify the server of any edit in progress in the
> custom control...I would like to know which server control triggered the
> postback whitin my custom control. Currently, my customControl is declared as
> follow:
>
> runat="server" DisabledStateControlId="Button1"
> OnUpdateOccured="UpdateInProgressPanel1_UpdateOccured">
>
> and the following events will trigger a postback:
>
> document.onchange = handleEvent;
> interceptor.onclick = handleEvent;
> interceptor.onkeypress = handleEvent;
> interceptor.onkeydown = handleEvent;
> interceptor.onpaste = handleEvent;
>
> My problem is that after postback, I would like to set the focus on the
> control which triggered the post back. So far, I have used the following:
> string ctrlname = page.Request.Params.Get("__EVENTTARGET");
> and
> if
> (((ScriptManager)this.Page.FindControl("ScriptManager1")).Is InAsyncPostBack)
> fromWhere =
> this.Page.Request[((ScriptManager)this.Page.FindControl("Scr iptManager1")).ID];
> in order to get the control but i am always getting the custom control. I
> want to associated postback events to the custom control only but would like
> to know which control within it originated the postback...
>
> Any help will be appreciated.
>
> Thanks,
> Kika
You should open up your custom control as open source so I can take a
gander. I've always wanted a control like what you have created. :)
RE: The control that triggered the UpdatePanel controls to refresh
am 17.01.2008 22:05:02 von brucebarker
in client script register a BeginRequestHandler and write the control id to a
hidden field.
Sys.WebForms.PageRequestManager.getInstance().add_beginReque st(
function(sender, args)
{
$get('myHiddenCtl').value = args.get_postBackElement();
});
-- bruce (sqlwork.com)
"Kika" wrote:
> Hi All,
> On my page, I have a custom control in which asp server controls can be
> added and a UpdatePanel to notify the server of any edit in progress in the
> custom control...I would like to know which server control triggered the
> postback whitin my custom control. Currently, my customControl is declared as
> follow:
>
> runat="server" DisabledStateControlId="Button1"
> OnUpdateOccured="UpdateInProgressPanel1_UpdateOccured">
>
> and the following events will trigger a postback:
>
> document.onchange = handleEvent;
> interceptor.onclick = handleEvent;
> interceptor.onkeypress = handleEvent;
> interceptor.onkeydown = handleEvent;
> interceptor.onpaste = handleEvent;
>
> My problem is that after postback, I would like to set the focus on the
> control which triggered the post back. So far, I have used the following:
> string ctrlname = page.Request.Params.Get("__EVENTTARGET");
> and
> if
> (((ScriptManager)this.Page.FindControl("ScriptManager1")).Is InAsyncPostBack)
> fromWhere =
> this.Page.Request[((ScriptManager)this.Page.FindControl("Scr iptManager1")).ID];
> in order to get the control but i am always getting the custom control. I
> want to associated postback events to the custom control only but would like
> to know which control within it originated the postback...
>
> Any help will be appreciated.
>
> Thanks,
> Kika