У меня есть всплывающее окно Bootstrap Model:
<asp:UpdatePanel ID="upModal" runat="server">
<ContentTemplate>
<!-- Bootstrap Modal Dialog -->
<div class="modal fade" id="myModal" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">ADD NEW BANQUET</h4>
</div>
<div class="modal-body" style="padding-left: 0px;padding-right:0px">
<div class="col-lg-12" style="padding-left: 0px;padding-right:0px">
<div class="form-group col-lg-6">
<label>Banquet ID:</label>
<u><asp:Label ID="lblID" CssClass="form-control" Text="AUTO ID" runat="server"></asp:Label></u>
</div>
<div class="form-group col-lg-6">
<label>Banquet Name:</label>
<asp:TextBox ID="txtName" CssClass="form-control" runat="server"></asp:TextBox>
</div>
</div>
<div class="modal-footer" style="padding-left: 0px;padding-right:0px">
<asp:Button ID="btnSave" runat="server" OnClick="btnSave_Click"
CssClass="btn btn-success btn-lg btn-block" Text="SAVE" UseSubmitBehavior="false"
data-dismiss="modal" />
</div>
</div>
</div>
</div>
</div>
<!-- /.modal -->
</ContentTemplate>
</asp:UpdatePanel>
<!-- /.upModel -->
И GridView:
<div class="col-lg-12 table-responsive">
<asp:GridView ID="gvBanquet" CssClass="table table-striped table-bordered table-hover" runat="server"
AutoGenerateColumns="false" OnRowCommand="gvBanquet_RowCommand" AllowPaging="True" PageSize="5"
EmptyDataText="No record found!" OnPageIndexChanging="gvBanquet_PageIndexChanging" ShowHeaderWhenEmpty="true">
<Columns>
<asp:TemplateField HeaderText="Banquet Name">
<ItemTemplate>
<asp:Label ID="lblID" runat="server" Visible="false" Text='<% #Eval("bqtID") %>'></asp:Label>
<asp:Label ID="lblName" runat="server" Text='<% #Eval("bqtName") %>' ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
<center>Events</center>
</HeaderTemplate>
<ItemTemplate>
<asp:Button ID="btnEdiit" runat="server" CssClass="btn btn-danger btn-sm" CommandName="EditRow" Text="Edit" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<HeaderStyle BackColor="#5cb85c" BorderColor="#4CAE4C" ForeColor="White"></HeaderStyle>
<PagerStyle Font-Size="Larger" ForeColor="Black" HorizontalAlign="Center" />
</asp:GridView>
</div>
<!-- /.col-lg-12 -->
Вот событие RowCommand:
protected void gvBanquet_RowCommand(object sender, GridViewCommandEventArgs e)
{
GridViewRow row = (GridViewRow)(((Control)e.CommandSource).NamingContainer);
int index = row.RowIndex;
string id = GetTextFromGridViewLabel(gvBanquet,index,"lblID");
string name = GetTextFromGridViewLabel(gvBanquet, index, "lblName");
switch (e.CommandName)
{
case "EditRow":
lblID.Text = id;
txtName.Text = name;
break;
default:
break;
}
}
Моя проблема в том, что когда я нажимаю кнопку "Редактировать" в GridView, модель Bootstrap не отображается в id
и name
из строки GridView.