Can not call a method that is located outside the AJAX UpdatePanel

I have AJAX UpdatePanel wrapped around GridView control. When user clicks on the button inside the panel I need to display
message in the Label control that is located outside the UpdatePanel. I need to call method that will show the message.
In a debug mode I placed a breakpoint to the method call it stops there and it seems that partial page rendering does not allow to call methods outside the UpdatePanel. Any suggestions how to call the method from the UpdatePanel:

Here the code snippet:

#region GridView_OnRowCommand methods

    protected void gvUnpostedTransSummary_OnRowCommand(object sender, GridViewCommandEventArgs e)
    {

        if (e.CommandName.Equals("post"))
        {  this.GetTransactionArguments(e.CommandArgument.ToString()); }  
       
    }

    private void GetTransactionArguments(string rowID)
    {
        int row = -1;
        string agencyID = string.Empty;
        decimal total = 0.0m;
        string userID = string.Empty;

        int.TryParse(rowID as string, out row);

        if (row != -1)
        {
            GridViewRow selectedRow = gvUnpostedTransSummary.Rows[row];

            agencyID = ((Label)selectedRow.FindControl("lblAgencyID")).Text;
            total = Convert.ToDecimal(((Label)selectedRow.FindControl("lblTotal")).Text);
            userID = ((Label)selectedRow.FindControl("lblUserID")).Text;
                                 
        }
        else
        {          
            string msg = "Unexpected error has occured!Please contact IT Department";
           
            this.SetInfoMessage(msg,InfoMsgColor.Maroon);   // This method is defined in the code-behind. It never gets called!!!
     
        }
 
    }


    #endregion

Please advice!


alik13Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

zkeownCommented:
The label control can't be updated if it's not inside an UpdatePanel.  You could either move it inside the same updatepanel as the gridview or give it its own UpdatePanel and set a trigger to the GridView's RowCommand event.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
alik13Author Commented:
Thank you! I will try it.
0
alik13Author Commented:
I decided to give it its own UpdatePanel and set a trigger to the GridView's RowCommand event.

<ContentTemplate>
                                    <asp:Label ID="lblInfo" runat="server" Visible="False" Width="290px"></asp:Label>
                                </ContentTemplate>
                                <Triggers >
                                 <ajax:AsyncPostBackTrigger ControlID ="gvUnpostedTransSummary" EventName ="gvUnpostedTransSummary_OnRowCommand" />
                                </Triggers>
                            </ajax:UpdatePanel>

but when I click on the form I get the following error message:

"Could not find an event named 'gvUnpostedTransSummary_OnRowCommand' on associated control 'gvUnpostedTransSummary' for the trigger in UpdatePanel 'upInfo'."
0
alik13Author Commented:
Never mind guys,  I found the solution.

<Triggers >
        <ajax:AsyncPostBackTrigger ControlID ="gvUnpostedTransSummary" EventName "RowCommand" />      </Triggers>

  Solution:  instead of using EventName ="OnRowCommand" like in the origanal GridView, I need to change it to
        EventName ="RowCommand"

Thank you guys!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.