0

I am using an UpdatePanel to show some controls that are normally hidden.

This is the code that I am using:

<asp:LinkButton runat="server" class="btn blue h27" CausesValidation="false" ID="lnkSuggestArticle"
                OnClick="lnkSuggestArticle_Click"><%=Supplier.GetResource("Answers_lnkSuggestArticle")%> <i class="icon icon_next_02 fr"></i></asp:LinkButton>
            <asp:UpdatePanel runat="server">
                <ContentTemplate>
                    <div class="infoRequest" id="divSuggestion" runat="server" visible="false">
                        <br class="clearfix" />
                        <h3>
                            Please provide the information you want to see on our support site:</h3>
                        <br class="clearfix" />
                        <asp:TextBox runat="server" ID="txtSuggestArticle" Rows="10" ValidationGroup="s" Width="100%"
                            TextMode="MultiLine"></asp:TextBox>
                        <div id="divEmailAddress" runat="server" visible="false">
                            <br />
                            <h3>
                                Please enter your email address</h3>
                            <asp:TextBox runat="server" ID="txtEmailAddress" Rows="1" ValidationGroup="s" CssClass="suggestionEmail"
                                TextMode="SingleLine"></asp:TextBox>
                            <br />
                        </div>
                        <br />
                        <asp:Label runat="server" ID="lblSugestedArticleError" ForeColor="Red" Visible="false"></asp:Label>
                        <asp:Label runat="server" ID="lblMessage" ForeColor="Red"></asp:Label>
                        <br />
                        <asp:LinkButton ID="btnSaveSuggestion" ValidationGroup="s" runat="server" OnClick="btnSaveSuggestion_Click"
                            CssClass="btn blue fr"><%=Supplier.GetResource("createticket_btnSuggest")%> <i class="icon icon_next_02 fr"></i></asp:LinkButton>
                        <%--<input type="submit" value="Suggest" class="btnSuggest" />--%>
                        <br />
                        <br />
                        <p id="notice" runat="server">
                            <asp:Label runat="server" ID="lblSuggestionNote" /></p>
                    </div>
                </ContentTemplate>
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="lnkSuggestArticle" />
                </Triggers>
            </asp:UpdatePanel>

When the user clicks the lnkSuggestArticle button I execute the following code:

protected void lnkSuggestArticle_Click(object sender, EventArgs e)
{
    divSuggestion.Visible = true;
    if ((WFSS.DataAccess.Entities.Customer)Session["__currentCustomer"] == null)
    {
        divEmailAddress.Visible = true;
    }
}

But it doesn't update the page. The div still stays hidden when the user clicks the suggest button.

4

2 回答 2

1

It turns out that there was a bug in Visual Studio. I had commented a piece of code in the aspx file. Turns out even though it appeared to be commented the code still executed which caused another update panel to be added which gave me an error in javascript.

于 2013-07-03T11:27:11.673 回答
1
   protected void lnkSuggestArticle_Click(object sender, EventArgs e)
{
    divSuggestion.Visible = true;
    if (Session["__currentCustomer"] == null)
    {
        divEmailAddress.Visible = true;
    }
}
于 2013-07-03T12:40:20.540 回答