I am currently working on implementing a Bootstrap modal with a label control. The modal is triggered by clicking a button, and I am facing an issue where I need to change the text of the label before the modal launches. However, the text that is supposed to come from the C# end never triggers because it seems like the postback does not occur (possibly due to the modal blocking it). As a result, the text remains unset.
My objective is to: Click the button, set the label text (which needs to be fetched from the back end), and then display the modal. Below is what I have implemented so far:
<asp:Button ID="btnEasy" runat="server" CssClass="btn btn-success" Text="Easy" Width="200px" Height="50px" data-toggle="modal" data-target="#modalQuestion" data-backdrop="static" data-keyboard="false" OnClick="btnEasy_Click"/>
<div class="modal fade" id="modalQuestion" tabindex="-1" role="dialog" aria-labelledby="questionHeader">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="questionHeader">Easy Question</h4>
</div>
<div class="modal-body">
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Label ID="lblQuestion" runat="server" Text="Question"></asp:Label>
<br />
<br />
<asp:Label ID="lblAnswer" runat="server" Text="Answer"></asp:Label>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnEasy" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="btnShowAnswer" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</div>
<div class="modal-footer">
<asp:Button ID="btnShowAnswer" runat="server" CssClass="btn btn-primary" Text="Show Answer" UseSubmitBehavior="false" OnClick="btnShowAnswer_Click"/>
<asp:Button runat="server" CssClass="btn btn-default" data-dismiss="modal" Text="Close" />
</div>
</div>
</div>
</div>
C#:
protected void btnEasy_Click(object sender, EventArgs e)
{
lblQuestion.Text = "Easy clicked";
}