Stuff inside UpdatePanel disappear

I have a BUTTON inside an update panel:  hlViewTranHistory

I have another updatepanel that has a GRID inside it. There's a button as part of the grid.
this is "btnProcess"

When i click the GRID button (btnProcess), i call a function that updates the other button's text.  ***But this button wont even show up when I put it insde an update panel. OUTSide the update panel, the text wont get updated.

What to do? I called the function inside the GRID's button event. I think i even tried the Grid's itemdatabound...
<asp:Content ID="Content2" ContentPlaceHolderID="PageMenu" Runat="Server">
 
<asp:Button ID="hlViewTranHistory"   Visible="false"   runat="server"/>
</asp:Content>
 
----function
 
 private void NumberOfTransactions(Guid orderID)
    {
 
        int num = OrderProcessingFacade.GetNumberOfTransactions("Deck", orderID);
 
        if (num > 0)
        {
            hlViewTranHistory.Visible = true;
            
            hlViewTranHistory.Text = string.Concat("View: ", num.ToString());
        }
        else
        {
       
        }
 
    }

Open in new window

LVL 7
CamilliaAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
wht1986Connect With a Mentor Commented:
Yup if you are using updatepanels, you'll need a scriptmanager
0
 
P_RamprathapCommented:
What value have you set in UpdateMode , is that set to "Always"
 
Ram
0
 
CamilliaAuthor Commented:
by default it's set to "Always".
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
CamilliaAuthor Commented:
that's the default value of UpdatePanel, no?
0
 
wht1986Commented:
if its inside the grid (as a column are you capturing the row command event. My code below works fine with the 2 update panels in this manner
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
                DataKeyNames="PrimaryID" DataSourceID="SqlDataSource1" 
                onrowcommand="GridView1_RowCommand">
                <Columns>
                    <asp:ButtonField CommandName="PressMe" Text="PressMe" />
                    <asp:BoundField DataField="PrimaryID" HeaderText="PrimaryID" InsertVisible="False" ReadOnly="True" SortExpression="PrimaryID" />
                    <asp:BoundField DataField="Column1" HeaderText="Column1" SortExpression="Column1" />
                    <asp:BoundField DataField="Column2" HeaderText="Column2" SortExpression="Column2" />
                </Columns>
            </asp:GridView>
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:Expert ExchangeConnectionString %>" SelectCommand="SELECT * FROM [TestTable]"></asp:SqlDataSource>
        </ContentTemplate>
    </asp:UpdatePanel>
    <asp:UpdatePanel ID="UpdatePanel2" runat="server">
        <ContentTemplate>
            <asp:Button ID="Button1" runat="server" Text="You Havent Clicked yet" />
        </ContentTemplate>
    </asp:UpdatePanel>
    </form>
</body>
</html>
 
 
===============================================
 
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "PressMe")
            this.Button1.Text = "Yay It worked";
    }

Open in new window

0
 
CamilliaAuthor Commented:
i think i dont have a scriptmanager on the page.
0
 
CamilliaAuthor Commented:
let me see. I might have it on the master page tho. Let me try it again.
0
 
wht1986Commented:
Farz, did you get things working?
0
 
CamilliaAuthor Commented:
not yet, Will post back,.
0
All Courses

From novice to tech pro — start learning today.