How To Get The Id Of Updatepanel Which Initiated A Postback

May 25, 2010

I need to intercept server callback after udate panel async post back and determine which panel initiated the request. The code is pretty simple:

Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(InterceptUpdateCallback);
function InterceptUpdateCallback(sender, args)
{
var updatedPanels = args.get_panelsUpdated();
for (idx = 0; idx < updatedPanels.length; idx++) {
if (updatedPanels[idx].id == "myUpdatePanel") {
StartSmth();
break;
}
}
}

And it works when UpdatePanel is not inside another UpdatePanel. But when it is inside another UpdatePanel updatedPanels[idx].id has parent Updatepanel id. So how can I get the id of UpdatePanel which initiated the request (the inner UpdatePanel)?

View 3 Replies


Similar Messages:

AJAX :: How To Trigger Updatepanel Postback From Another Updatepanel

Mar 4, 2011

I have a web user control with one updatepanel (pnlUpdate_2), some controls and one apply button. I display the web user control as a modalpopup in my default page. In my default page i have an updatepanel (pnlUpdate_1) with a gridview and I modify that gridview with the apply button of the web user control. The web user control is for made a custom search of the gridview data. I have a problem with both updatepanels. If I set the updatemode as always in one of them (pnlUpdate_1) and the other as conditional (pnlUpdate_2), the pnlUpdate_1 make a postback in the pnlUpdate_2; I'm not an expert on this but I think that's why the pnlUpdate_2 disappear and reappear after postback of some controls in that updatepanel (not the apply button, it close the modal after postback). I try all the combinations and the problem persists. So I put both updatepanels as conditional and in some way it works; now the problem is that when I click the apply button in pnlUpdate_2 to modify the gridview in pnlUpdate_1 the pnlUpdate_1 not made the postback I get the pnlUpdate_2 postback when I use some control inside the pnlUpdate_1.

How can I postback the pnlUpdate1 from pnlUpdate_2 with the apply button?

View 3 Replies

Get IP Of Server That Initiated Redirect

Jul 26, 2010

A user clicks a hyperlink in a page. Server A handles the request and redirects the client to a URL on Server B (more specifically I am using the Response.Redirect method in .NET on server A). I have been asked to restrict access to Server B to redirects originating from Server A only (by blocking IP's other than Server A's). At first I thought this could be achieved by using the HTTP 'referer' header, however, it seems it is up to the browser to set this to a URL (rather than IP), and it is not guaranteed to do so.

I guess there is no way to set the HTTP 'referer' on server A in .NET (to server A's IP)? (my intuition is that would be a security hole). So my question is, how can I restrict access to Server B to redirects originating from Server A?

View 3 Replies

AJAX :: Server Side Confirmation - Not Control Initiated

Sep 25, 2013

URL...In the above page, the button fires the javascript first, then the code-behind sub runs.  The problem I have is I am in the middle of a code-behind sub routine that checks if a user is logged on the a PC.  If there is a users logged on, I want the confirm popup to ask whether to reboot anyway or cancel.  The code needs to dictate whether to call the javascript, not some direct button click.  Then I need the remainder of the code-behind sub to execute based on the users choice. 

I can call the client script in the code-behind sub using 'RegisterStartupScript...'; then I can get the page's form value.  The problem is that the sub runs to completion without waiting for the javascript code to run.  This causes code-behind variable to get checked before it's set by the client and it nevers works.

View 1 Replies

DataSource Controls :: How To Use 1 Database Connection In A Unit Of Work Initiated From The UI

May 4, 2010

I am designing a web application and have separate layers for UI, BAL, DAL and DB, while using custom business objects and collections. The app will be used by over 10,000 + registered used and it becoming more complex as I add new functionality such as inline editing and batch processing of collections with transactions ... which has me up late at night trying to design the best approach for this ...In some UI web forms, I bind say 3 controls to 3 different collections. The UI calls the BAL classes for the required collections, then binds the collection returned. So for each collection I want, a db connection is opened and closed. As I understand database connectivity adds overhead so Is there anyway I can design this so 1 database connection is created for a unit of work in a 3-tier or n-tier architecture?

View 7 Replies

How To Know Which UpdatePanel Causes The Partial PostBack

Jan 31, 2011

In a page contains two UpdatePanels, How can I know which UpdatePanel causes the partial PostBack ?

I mean in the Page_Load event handler.

This is my code:

[Code]....

View 2 Replies

C# - How To Keep TinyMCE After Postback In An UpdatePanel

Aug 17, 2010

When I click a button that causes a postback on the UpdatePanel it calls the tinyMCE.triggerSave().

It reloads the panel and the editor show up again, but when I try to call tinyMCE.triggerSave() the second time I get the following error:

g.win.document is null

I though it was getting the old instance, but I'm also removing the control (tinyMCE.execCommand('mceRemoveControl',false,'Editor');) after I call the save. Even so it still crashes the second time.

View 1 Replies

VS 2008 Full Postback In Updatepanel?

Jan 16, 2010

i have upgrade my website from framework 2.0 to 3.5 but i have problem with ajax .I get full postback when i click a linkbutton inside update panel .

View 14 Replies

How To Run A Javascript Event After A Postback Within An Updatepanel

Nov 19, 2010

How do i run a javascript event after a postback within an updatepanel

View 3 Replies

C# - ImageButton In UpdatePanel Doesn't PostBack

Aug 3, 2010

I created a form in a popup div, that contain an UpdatePanel with ImageButtons in it.Initially, I used LinkButtons to test but I wanted ImageButtons. The thing is, it works well with LinkButtons and not with ImageButtons (absolutely nothing happens).

<a href="javascript:WebForm_DoPostBackWithOptions(new
WebForm_PostBackOptions("ctl00$cphC$ctrlAdr$AdrMapo$lbAdresseSaisie",
"", true, "",
"", false, true))"
id="ctl00_cphC_ctrlAdr_AdrMapo_lbAdresseSaisie">test</a>
[code]...

View 1 Replies

Call Javascript After Updatepanel Postback?

Feb 9, 2011

I put the following javascript code inline but it doesn't trigger after the updatepanel is done with its postback:

function EndRequestHandler(sender, args) { alert("this should work"); }
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);

View 2 Replies

UserControl Causes Full Postback In UpdatePanel

Mar 24, 2011

I'm having few UpdatePanels on my master page. And then, I have RadTreeViewcontrol on the page, that should cause partial postback each time node is clicked. Everything works fine there. Since I'm using the same tree on some other pages, I moved this functionality to UserControl. Stuff I've done before, so no problem. Moved some code to ascx, created some events. Everything always worked for me well. But not now. RadTreeView is nested inside UserControl, and this control on master page with update panels, see below:

<asp:Panel ID="pnlContentWrapper" runat="server" CssClass="ContentWrapper">
<div id="HeaderBreadCrumb">
<asp:ContentPlaceHolder ID="HeaderBreadCrumbContent" runat="server" />
</div>
<div id="HeaderMenu">
<asp:UpdatePanel ID="upnlTreeMenu" runat="server">
<ContentTemplate>
<asp:ContentPlaceHolder ID="HeaderMenuContent" runat="server" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="treeProductTree" />
</Triggers>
</asp:UpdatePanel>
</div>
<div id="TreeDiv">
<fp:ProductTree ID="treeProductTree" runat="server" />
</div>
<asp:Panel ID="ContentDiv" ClientIDMode="Static" runat="server">
<asp:UpdatePanel ID="upnlTreeContent" runat="server">
<ContentTemplate>
<asp:ContentPlaceHolder ID="TreePageContent" runat="server" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="treeProductTree" />
</Triggers>
</asp:UpdatePanel>
</asp:Panel>
</asp:Panel>
And the user control is really simple:
<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ProductTree.ascx.vb"
Inherits="ProductTree" %>
<div>
<telerik:RadTreeView ID="treeProductTree" ClientIDMode="Static" runat="server" EnableDragAndDrop="false"
SkinID="CustomSkin" CssClass="MasterProductTree" DataFieldID="NodeId" DataFieldParentID="NodeParentId"
DataTextField="NodeName" DataValueField="NodeId" />
</div>

And some code behind:

Imports Telerik.Web.UI
Public Class ProductTree
Inherits System.Web.UI.UserControl
Public Event NodeExpand As EventHandler(Of ProductTreeNodeExpandEventArgs)
Public Event SelectedNodeChange As EventHandler
Protected Sub ProductTree_NodeExpand(ByVal sender As Object, ByVal e As RadTreeNodeEventArgs) _
Handles treeProductTree.NodeExpand
Dim nodeId As Integer = CInt(e.Node.Value)
Dim evetArgs = New ProductTreeNodeExpandEventArgs(nodeId)
RaiseEvent NodeExpand(Me, evetArgs)
//'some logic
End Sub
Protected Sub ProductTree_OnNodeClick(ByVal sender As Object, ByVal e As RadTreeNodeEventArgs) _
Handles treeProductTree.NodeClick
RaiseEvent SelectedNodeChange(Me, New System.EventArgs())
End Sub
End Class

What I don't know is: why is this causing full postback instead of partial? I suspect that it may have something to do with raising my for SelectedNodeChange, but I don't know how to deal with it other way. I need to let other components know, that node selection changed. How can I improve this to make it work with UpdatePanels?

View 1 Replies

Updatepanel Gives Full Postback Instead Of Asyncpostback

Nov 30, 2010

I have run into what seems to be a very famous problem: My updatepanel fires a full postback instead of a async postback. The normal solution is to give all controls you add dynamically an ID, which I have done, but I still get a full postback instead of my async postback. Here's the code:

HTML:

<asp:UpdatePanel ID="ItemsUpdatePanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="False">
<Triggers>
</Triggers>
<ContentTemplate>
<asp:ListView ID="PlayerItems" runat="server" GroupItemCount="5"
onitemdatabound="PlayerItems_ItemDataBound">
<LayoutTemplate>
... Listview stuff ...
</asp:ListView>
</ContentTemplate>
</asp:UpdatePanel>

The interesting part is the C# code behind (method PlayerItems_ItemDataBound), which is like the following:

ImageButton imgBtn = new ImageButton();
imgBtn.ID = "itemBtn";
imgBtn.Width = Unit.Pixel(30);
imgBtn.ImageUrl = "~/Images/Game/Items/" + myItem.ItemImageUrl;
ContextMenu menu = new ContextMenu();
menu.BoundControls.Add(imgBtn);
menu.ItemCommand += new CommandEventHandler(menu_ItemCommand);
menu.AutoHide = true;
menu.RolloverColor = Color.Gray;
menu.ID = "MenuMenu";
Panel panel = (Panel)(e.Item.FindControl("ItemPanel"));
panel.Controls.Add(imgBtn);
panel.Controls.Add(menu);
AsyncPostBackTrigger trig = new AsyncPostBackTrigger();
trig.ControlID = menu.UniqueID;
trig.EventName = "ItemCommand";
ItemsUpdatePanel.Triggers.Add(trig);

So, I actually add an AsyncPostBackTrigger to the menu, so the ItemCommand event should be registered. What happends when I click an item in this contextmenu, is a full postback happends. I have been trying to play with the ChildrenAsTriggers property without help.

View 2 Replies

AJAX :: Avoiding Postback Using Updatepanel?

Sep 24, 2010

avoiding postback using updatepanel

View 4 Replies

LinkButtons In A Repeater Within An UpdatePanel Are Not Triggering A Postback

Sep 13, 2010

My page contains a Repeater that is loaded with data asynchronously as the data becomes available, using an UpdatePanel to manage the asynchronous requests.The page contains something a little like this:

<asp:UpdatePanel ID="DataUpdatePanel" runat="server">
<ContentTemplate>
<table>
<asp:Repeater ID="RepeaterBlock" runat="server">
<HeaderTemplate><thead><tr><th>Name</th><th>Status</th><th class="empty"></th></tr></thead></HeaderTemplate>
<ItemTemplate><tr>
[code]...

The problem being that the LinkButton does not appear to trigger a postback of any kind- there is no visible response to clicking on it and putting a break point on the event listener in the codebehind, it is never triggered.
hat the linkbuttons ceased working.

View 2 Replies

Javascript - Retrieve If An Updatepanel Has Made A Postback?

Oct 8, 2010

I can retrieve with JavaScript above the ASP.NET Updatepanel had made a asynchronous postback ?

View 1 Replies

How To Get The Id Of Updatepanel That Triggered The Async Postback On Serverside

Sep 16, 2010

I know about Always vs. Conditional, I just need to know exactly which update panel's data needs to be refreshed (not taken from app tier cache) on the serverside.

View 1 Replies

AJAX :: Forcing Full Postback In UpdatePanel

Apr 19, 2010

I have basically the following structure set up :

[Code]....

I am aware that a FileUpload requires a full page postback. I read the article http://www.4guysfromrolla.com/articles/090209-1.aspx[^]I tried to install a PostBackTrigger programmatically to get a full postback only on the ImageButton1 control. All other postbacks must be partial. (GridView sorting, paging, ...)In code behind I do :

[Code]....

The above code does not seem to install a full postback only for the ImageButton1, so the file upload fails. How can I make this work ?

View 6 Replies

C# - Timer Results In Updatepanel Gives Full Postback

Jan 19, 2011

I have a quite strange situation where I have the following code:

<asp:Timer ID="GameClock" runat="server" Interval="5000" Enabled="true"
ontick="GameClock_Tick">
</asp:Timer>
<asp:UpdatePanel ID="ItemsUpdatePanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false">
<Triggers>

NOTE THE TRIGGER IS COMMENTED OUT

<%--<asp:AsyncPostBackTrigger ControlID="GameClock" EventName="Tick" />--%>
</Triggers>
<ContentTemplate>
<asp:ListView ID="PlayerItems" runat="server" GroupItemCount="7"
onitemdatabound="PlayerItems_ItemDataBound">
<LayoutTemplate>
<table border="1" cellpadding="2" cellspacing="0" runat="server" id="tblProducts">
<tr runat="server" id="groupPlaceholder">
</tr>
</table>
</LayoutTemplate>
<ItemTemplate>
<td id="Td1" runat="server" style="vertical-align:top; text-align:left; height:100%;">
<div>
<div id="category" runat="server">
<asp:Panel ID="ItemPanel" runat="server">
</asp:Panel>
</div>
</div>
</td>
</ItemTemplate>
<GroupTemplate>
<tr runat="server" id="productRow">
<td runat="server" id="itemPlaceholder"></td>
</tr>
</GroupTemplate>
</asp:ListView>
</ContentTemplate>
</asp:UpdatePanel>

This gives a quite strange result: Every 5s my whole page gives a full postback. When I comment in (activate) the asyncpostbacktrigger, the updatepanel does not give a full postback. In the PlayerItems_ItemDataBound I have the following code (which, I do think, do not matter):

protected void PlayerItems_ItemDataBound(object sender, ListViewItemEventArgs e)
{
if (e.Item.ItemType == ListViewItemType.DataItem)
{
ListViewDataItem dataItem = e.Item as ListViewDataItem;
if (dataItem != null)
{
BaseItem myItem = dataItem.DataItem as BaseItem;
Panel itemPanel = new Panel();
Literal firstLiteral = new Literal();
firstLiteral.Text += "<div id='smoothmenu1' class='ddsmoothmenu'>";
firstLiteral.Text += "<ul>";
firstLiteral.Text += "<li><img src='Images/Game/Items/" + myItem.ItemImageUrl + "' />";
firstLiteral.Text += "<ul>";
// Add all events bound to item into contextmenu
itemPanel.Controls.Add(firstLiteral);
foreach (Delegate del in myItem.Actions.Items)
{
Literal firstItLit = new Literal();
firstItLit.Text += "<li>";
itemPanel.Controls.Add(firstItLit);
MethodInfo methodInfo = del.Method;
string commandName = myItem.ItemId + "|" + methodInfo.Name;
LinkButton btn = new LinkButton();
btn.Text = methodInfo.Name;
btn.Click += new EventHandler(btn_Click);
btn.CommandName = commandName;
itemPanel.Controls.Add(btn);
Literal secondItLit = new Literal();
secondItLit.Text += "</li>";
itemPanel.Controls.Add(secondItLit);
}
Literal btnLiteral = new Literal();
btnLiteral.Text += "</ul>";
btnLiteral.Text += "</li>";
btnLiteral.Text += "</ul>";
btnLiteral.Text += "</div>";
itemPanel.Controls.Add(btnLiteral);
Panel panel = (Panel)(e.Item.FindControl("ItemPanel"));
panel.Controls.Add(itemPanel);
}
}
}

When I create a NEW updatepanel, ItemsUpdatePanel1, it does not fire a full postback without the timer. I can even start copying items from ItemsUpdatePanel to ItemsUpdatePanel1, and suddenly the full postbacks happen. I tried 2 seperate times, and they started happening at different times.

View 2 Replies

AJAX :: GridView In UpdatePanel With Full Postback

May 13, 2010

I have got the following gridview with a UpdatePanel and approve and save button in each row. How do I create a full postback if approve button is click and asyncPostback if save button is click.

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<Triggers>
<asp:PostBackTrigger ControlID="btnApprove" />
</Triggers>
<ContentTemplate>
<asp:GridView ID="gvApproval" runat="server" CssClass="gridview" BorderColor="#E5E5E5"
Width="98%" AutoGenerateColumns="False" DataKeyNames="NewProcessId" OnRowCommand="gvApproval_RowCommand"
OnRowDataBound="gvApproval_RowDataBound" OnRowEditing="gvApproval_RowEditing">
<Columns>
<asp:TemplateField Visible="False">
<ItemTemplate>
<asp:Label ID="lblApprovalId" runat="server" Text='<%# Bind("ApprovalId") %>' Width="1px"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Comment">
<ItemStyle Width="80%" Wrap="True" />
<ItemTemplate>
<asp:Label ID="lblComment" runat="server" Text='<%# Eval("Comment").ToString().Replace("
", "<br />") %>'></asp:Label>
<asp:TextBox ID="txtApprovalComment" runat="server" CssClass="textMessageBox" TextMode="MultiLine"
Width="98%" Visible="false"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvApprovalComment" runat="server" ControlToValidate="txtApprovalComment"
Display="Dynamic" CssClass="textErrorMessageNormal" ErrorMessage="Comment is required before approval"
ValidationGroup="Approve"></asp:RequiredFieldValidator><br />
<asp:ImageButton ID="btnApprove" runat="server" CssClass="spbutton" Visible="false"
ImageUrl="~/Images/ButtonApprove.gif" ValidationGroup="Approve" CommandName="Approve">
</asp:ImageButton>
<asp:ImageButton ID="btnSave" runat="server" CssClass="spbutton" Visible="false"
ImageUrl="~/Images/ButtonSave.gif" ValidationGroup="Save" CommandName="Save">
</asp:ImageButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<PagerStyle CssClass="pager" />
<HeaderStyle CssClass="gridtableHeading" Wrap="False" />
<AlternatingRowStyle CssClass="alternateRow" />
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>

View 2 Replies

AJAX :: UpdatePanel Is Not Working - It Always Postback Instead Of Callback?

Jan 21, 2010

I have updatePanel in my ASP.NET 2.0 (migrated from ASP.NET 1.1) web app. It doesn't work as it always postback instead of callback. I already set<xhtmlConformance mode="Transitional" /> but still not working. Previously, it just working.

[Code]....

View 5 Replies

Determining Which Button Caused The Postback In An UpdatePanel?

Oct 18, 2010

In Page_Load, Request["__EVENTTARGET"] is an empty string.IS there some way I can find out which button triggered the postback before hitting the buttons event handler

View 2 Replies

Ajax UpdatePanel Controls Full Postback

Mar 7, 2011

I have a webform which has an updatepanel with a combobox, add button, delete button and a table. The functiion of the two buttons is to add or delete table rows. However, the table is getting cleared everytime the combobox item is selected. Is there anotherway of retaining the table contents?The code for the updatepanel is:

<asp:UpdatePanel ID="UpdatePanelTreatment" runat="server" UpdateMode="Conditional">
<triggers>
<asp:PostbackTrigger ControlID="cboTreatment" />
asp:PostbackTrigger ControlID="btnAdd" />

View 3 Replies

AJAX :: Scrollbar Is Reset By Updatepanel Postback - How To Fix It

Jul 20, 2010

I have an Usercontrol which has a update panel that being postback by a timer, and it is nested in a parent page which has its own update panel. Every time that the update panel in UserControl cause a postback to server my main page's scrollbar being reset to top or buttom of the page. I enabled viewstate of parent page but nothing, and when enable parent page's MaintainScrollPOsitionOnPOstback it cause a problem for Usercontrol updatepanel postback !

View 2 Replies

.net : Exclude Control In Updatepanel From Doing Async Postback

Dec 8, 2010

I have placed a user control inside update panel after doing asynchronous postback of page associated js file of that user control is not working so that is there any method to exclude a control from updatepanel in another word i don't want to post that user control.

<asp:UpdatePanel ID="upPnlAnswerList" runat="server">
<ContentTemplate>
// another code that required to placed inside updatepanel
<div id="miancontainer" class="containerr"
<klmsuc:Share ID="shareUserControl" runat="server" />
[code]...

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved