Link to home
Start Free TrialLog in
Avatar of Camillia
CamilliaFlag for United States of America

asked on

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

Avatar of P_Ramprathap
P_Ramprathap
Flag of India image

What value have you set in UpdateMode , is that set to "Always"
 
Ram
Avatar of Camillia

ASKER

by default it's set to "Always".
that's the default value of UpdatePanel, no?
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

i think i dont have a scriptmanager on the page.
ASKER CERTIFIED SOLUTION
Avatar of wht1986
wht1986
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
let me see. I might have it on the master page tho. Let me try it again.
Farz, did you get things working?
not yet, Will post back,.