.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Post New Web Links

Update Panels, Postback Triggers, and GridViews, Oh my

Posted By:      Posted Date: September 10, 2010    Points: 0   Category :ASP.Net
I've been battling with this page for the past couple days and it works, but it's annoying, so I am hoping someone maybe has dealt with this and can help me a little.   I have an UpdatePanel that acts as a container for a number of other update panels, everything in this container works.  I got the bright idea to add a ModalPopup Extender to enhance the user experience a little when performing a certain function on the site.  The panel that acts as the container for the ModalPopup sits outside the UpdatePanel Container because if it's in the container, any interaction with a child control throws "Input string not in the correct format" error message.  Because this is outside the comfort of the UpdatePanel Container, any control that populates information into the Popup control has to register a Postback.  Thus my problem: the controls that populate the Popup are GridViews.  The only GridView Event I care to cause a PostBack is the SelectedIndexChanged, but PostBack Triggers don't care, they take all comers.  Want to go to the next page? PostBack. Sort? Hell Yeah, Postback. My initial solution is to provide a confirm type of a message under the gridview and have the user confirm their selection by clicking a button to avoid causing a postback until it's necessary, but you know what? That kinda sucks, so I sub

View Complete Post

More Related Resource Links

Update Panel only doing full postback

I have a page with a TabContainer with 3 tabs.  Within each tab, I have an UpdatePanel.  One of my UpdatePanel's update mode is set to "conditional" and I've added an asyncpostbacktrigger with the controlId="btnClearEmail1" and the eventname="Click".  When I run the page and click the button assigned to the asyncpostback trigger, the page will do a full postback.  Am I forgetting something?  How can I get it to just refresh what is inside the UpdatePanel?  <asp:tabcontainer id="ajaxTabContainer" runat="server"> <asp:tabpanel id="ajaxTabCustomerInfo" runat="server" headertext="Customer Information" visible="true"> <contenttemplate> ... [clipped for brevity] </contenttemplate> </asp:tabpanel> <asp:tabpanel id="ajaxTabSiteBranding" runat="server" headertext="Custom Site Branding"> <contenttemplate> <asp:updatepanel id="UpdatePanel2" runat="server"> <contenttemplate> ... [clipped for brevity] </contenttemplate> </asp:updatepanel> </contenttemplate> </asp:tabpanel> <asp:tabpanel id="ajaxTabEmails" runat="server" headertext="E-mail Notifications"> <contenttemplate> <div> <asp:panel

chrome and safari problems with log ins and sign ups in update panels

Hi,This is probably a common problem.I have log in and sign up controls in update panels. They are being focussed on when the user clicks the appropirate button. Once done, hitting the sign-up or the log-in button, the browser (FF, IE) updates the update panels and all looks nice.In chrome and safari however, this does not work quite as nice. Login and sign up still happen. But focussing the controls does not, neither does the update panel update. The user has to reload the page to see that he is actually logged in or has signed up.This is really not nice and I found a very strange error, given that update panels work fine under other circumstances.Whats the problem here and how can this be solved?Thank you very much.Regards,D

How to determine if a user control is contained by the update panel that triggered async postback

Does anyone know a simple way to determine if a user control is contained in an update panel that was triggered for async postback?At the moment, the only pseudo logic for this I can think of is?'Loop through the update panel controls on the page and find the one that is involved in the postback (isInPartialRendering)'Try to find the user control as a child of the update panel

Update panal and triggers outside


I have a few buttons on a web page.

I have an update panel and I have 2 triggers that reference button 1 and 2 outside my update panel.

When I click on button 1  and 2 I want the update panel to "update" with content without a whole page refresh.

This seems simple enough but when I run I get the following error:

A control with ID 'btn1' could not be found for the trigger in UpdatePanel 'updateSomething'.

Here is my code.

<asp:button ID="btn1" Text="press me" Click="btn1_Click></asp:button>

<asp:button ID="btn2" Text="press me2" Click="btn2_Click></asp:button>

<asp:UpdatePanel ID="updateSomething" UpdateMode="Condtional" runat="server">
                    <asp:AsyncPostBackTrigger ControlID="btn1" runat="server"  EventName="Click" />

Color Box Jquery Not Working in Update Panel After the Initial Postback


Hi Guys,

I have an UpdatePane that contains a Listview


		<asp:LinkButton ID="lnkName" runat="server" CommandArgument='<%# Container.DisplayIndex %>'
            CommandName="SelectedRow" Text='<%# Eval("Name") %>' Class="info" Rel='<%# Eval("ID") %>' />

This linkButton will serves as the trigger to call my color box jquery. Function stated below

 <script src="script/jquery-1.4.1.min.js" type="text/javascript"></script>
    <script src="script/jquery.colorbox-min.js" type="text/javascript"> </script>
    <script type="text/javascript">

        $(document).ready(function() {

            $("a.info").click(function() {

                $(this).attr("href", "EmployeeDirectoryDetail.aspx?id=" + $(this).attr("rel"));
                $(this).colorbox({ height: "200p

page inside update panel doesn't refresh the session object after postback of any control



I have many controls like dropdown, radiobuttonlist, etc on my page and I put all these controls inside the update panel so that the page doesn't look to be posting back when something is selected. Now the working on the page is very smooth. But the session object isn't getting refreshed even if I postback to the server and as a result even if the users are working on the page they are being sent to the login screen after 20 mins.

Is there anyway where I could put all the controls in update panel and still refresh the session after any postback(dropdown selection)

Any help is greatly appreciated.

Thanks in advance

DRAGON (assistive technology) tool and update panels


Hello all,

Our web application currently uses a Master Page and each individual web page has at least one update panel.   Then each control has its own javascript to focus back on it after a page refresh.  Now the problem I am running into is the the listed AT tool is not being refreshed to see the appropriate controls unless the "Skip navigation" link (which points to the content of the page via "#Content") is selected.  Are there any suggestions on how to get the skip navigation link executed automatically?  Or even any suggestions on how to tackle this problem?  Our group cannot write this off as a work around nor as a vendor problem.   Thank you very much.

PostBack triggers Session_Start on Global.asax


Hi all, I'm facing a strange issue.

I have a simple aspx Page, which html contains:

<asp:Button ID="btn1" runat="server" Text="Set Session" onclick="btn1_Click" /> 
<asp:Button ID="btn2" runat="server" Text="Get Session" onclick="btn2_Click" />

and code behind:

public partial class MyPage : System.Web.UI.UserControl
    private List<string> myElements
        get { return (List<string>)Session["elements"]; }
        set { Session["elements"] = value; }

    protected void Page_Load(object sender, EventArgs e)


    protected void btn1_Click(object sender, EventArgs e)
        List<string> strs = new List<string>();

        myElements = strs;

    protected void btn2_Click(object sender, EventArgs e)
        List<string> strs = myElements;

        if (strs != null && strs.Count > 0)
            string s = "Ok";


This is quite simple. When I press btn1, it sets correctly the Session Key

How to prevent master page postback when update panel asynchronous postback happened


Hello everybody.

When an asynchronous postback happened inside update panel, another postback happens also for MasterPage not only update panel embedded page .

I want to prevent this MasterPage postback .

is this possible ?

think like i have a MasterPage

and another page which is test.aspx which is content page of MasterPage

i have update panel at test.aspx

when asynchronous postback happens at this test.aspx update panel it also loads MasterPage Page_Load

i want to prevent this (it should not also load MasterPage Page_Load)

Thank you

Update panel doing full postback


Hi, I am having an issue with an update panel, which is still causing the entire page to postback.

I have made sure i have all the correct bits in the web.config, section groups, httphandlers, httpmodules, additonal assemly etc... but it still does not work. I have got it to work in a way,which is why i think i have the config right, because if i take the search panel of and place it outwith the update panel, the go button only postsback the rest of the page not what is inside the updatepanel.

Just hoping someone can see where i am going wrong.

I am using a master page, but the update panel only appears in the content page, within the content tags.

Any ideas would be appreciated, thanks


<ajax:ScriptManager ID="scriptMgr" runat="server" />

        <ajax:UpdatePanel ID="panel" runat="server" ChildrenAsTriggers="true">
                <div class="searchToolbar">
                    <asp:Panel DefaultButton="searchButton" runat="server">
                        <asp:Label ID="Label1" runat="server">Search all vacancies</asp:Label>
                        <asp:TextBox ID="search" runat="server" />

Why cant I update my page on postback?


Hi Guys.,

Im trying to write a page that lets the user update their details and then will change the page on postback to reflect the new details they have entered into the form. For some reason its not working. I have used a Page_PreRender method and it is not getting the newly saved value from the database. It seems to be getting the value that was saved on the previous postback. Here is the code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CuteWebUI;
using VLSCore2;
using System.IO;
using System.Drawing;
using System.Drawing.Imaging;
using System.Drawing.Drawing2D;

namespace Vls.MyAccount
    public partial class Default : VLSProtectedPage
        private VlsContent contentManagerForPage;
        private VlsSecurity securityManagerForPage;
        protected VLSCore2.Entities.User userForPage;

        protected string urlOfFileToCrop;

        protected void Page_Load(object sender, EventArgs e)
            securityManagerForPage = new VlsSecurity(DbConnection);
            userForPage = securityManagerForPage.GetUser(UserId);



        protected void Page_PreRender(object sender, EventArgs e)
            securityManagerForPage = new V

Update Panel Postback Problem?



Related to my previous question which is answered. The deal is, there is an update panel for modalpopup extender that is triggered by a button. The problem is when the form is submitted by a button, this modal popup is seen on the page! I do NOT want this modal popup extender to be seen when the form is submitted.

Any help please?

Thanks in Advance.

Best regards.

<asp:Label ID="lblPopupTargetID" runat="server" Style="display: none;"></asp:Label>
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="lblPopupTargetID"
PopupControlID="Panel1" BackgroundCssClass="modalBackground" DropShadow="true" />
<asp:Panel ID="Panel1" runat="server" CssClass="modalPopup" Width="600px">
<asp:UpdatePanel runat="server" ID="UpdatePanel1">

using triggers to keep all versions of rows after update, delete + replication

I maintain an application that uses SQL 2005 / 2008 for data persistence.
Some clients use Merge Replication (pull or push) to replicate data.

Some of the tables contain information that should never be erased.
All versions of a row from such a table should be stored, somewhere in a database.

This means all updates and deletes to those rows should result in in 2 affected rows:
• a copy of the row before the change
• a row containing the change (or the deletion of the row in question)

I plan to achieve this using AFTER UPDATE,DELETE triggers on all the tables for which "versioning" is required.
The old versions of a row may be stored in the same database, an other database (or a database on a linked server).

I was hoping to do this by creating NOT FOR REPLICATION triggers on the published database.
The theory was:
All update and delete queries performed against a subscribed database should be replicated (for concurrency) to the publisher.
When the updates and deletes are replicated, the triggers on the published database will be fired, thus also updating the table containing the version rows.

There seem to be 2 problems with this approach:
An update query against a table of the subscriber wil often result in mupltiple update queries performed ag

Update textbox without postback


I have a simple page with 2 textbox: tb1, tb2.

When tb1 text is changed I would like to update tb2 (for example with the text of tb1), without postback the page (in javascript).

I know this question is very simple, but I'm quite new in asp.net.


how to know postback was due to update panel's partial update ?


when postback occurs due to update panel's child control then in page load event how can i know that it was dut to update panel ?

i.e., i want to differentiate between general postback and postback due to update panel's child control in page load event .

How is that possible ? 

jQuery $(document).ready() and ASP.NET Ajax asynchronous postback

Many call it the ASP.NET jQuery postback problem, but using the technique below should make it no problem anymore. $(document).ready() isn't called after an asynchronous postback. What this means? You lose the functionality that should be executed within $(document).ready() after an UpdatePanel rendered its contents after an asynchronous postback.

ASP.Net Gridview Edit Update Cancel Commands

In ASP.Net 2.0, GridView Control also provides the functionality to edit and update the data retrieved from the database using CommandField template. You can cancel the action using Cancel Command of the CommandField. GridView consists of events that can be used to perform the actions like edit, update and cancel upon the Data items displayed in the ASP.Net GridView Data Control.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend