PC Review


Reply
Thread Tools Rating: Thread Rating: 2 votes, 1.00 average.

The control that triggered the UpdatePanel controls to refresh

 
 
Kika
Guest
Posts: n/a
 
      17th Jan 2008
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:
<daf:UpdateInProgressPanel ID="UpdateInProgressPanel1"
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")).IsInAsyncPostBack)
fromWhere =
this.Page.Request[((ScriptManager)this.Page.FindControl("ScriptManager1")).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
 
Reply With Quote
 
 
 
 
younlaot
Guest
Posts: n/a
 
      17th Jan 2008
On Jan 17, 12:09 pm, Kika <K...@discussions.microsoft.com> 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:
> <daf:UpdateInProgressPanel ID="UpdateInProgressPanel1"
> 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")).IsInAsyncPostBack)
> fromWhere =
> this.Page.Request[((ScriptManager)this.Page.FindControl("ScriptManager1")).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.
 
Reply With Quote
 
bruce barker
Guest
Posts: n/a
 
      17th Jan 2008
in client script register a BeginRequestHandler and write the control id to a
hidden field.

Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(
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:
> <daf:UpdateInProgressPanel ID="UpdateInProgressPanel1"
> 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")).IsInAsyncPostBack)
> fromWhere =
> this.Page.Request[((ScriptManager)this.Page.FindControl("ScriptManager1")).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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
UpdatePanel - full refresh abcd Microsoft ASP .NET 1 3rd Oct 2008 04:03 PM
The control that triggered the UpdatePanel controls to refresh Kika Microsoft Dot NET 0 17th Jan 2008 05:10 PM
refresh an updatePanel in an other updatePanel fran_j_diaz@yahoo.fr Microsoft ASP .NET 3 8th Aug 2007 07:30 AM
Atlas UpdatePanel in Web User Control - How to update other controls? Remy Microsoft ASP .NET 0 26th Jul 2006 03:02 AM
One ContextMenu assigned to many controls - which control triggered it? PeterZ Microsoft C# .NET 2 11th Jan 2005 06:00 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:54 AM.