从Gridview Edit Linkbutton填充bootstrap模式 [英] Populate bootstrap modal from Gridview Edit Linkbutton
本文介绍了从Gridview Edit Linkbutton填充bootstrap模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有gridview包含会员提供者角色。
带链接按钮用于编辑和链接按钮用于删除。
i成功填充模态并绑定网格和所有这些,但是,如何将模态中的txtRoleName与行的角色名绑定?没有任何回复,如果它可能发生或回帖如果不是。
这里是我的代码
i have gridview contain membership providers Roles.
with Link Button For edit and Link button for deleting .
i succeeded in populate the modal and bind the grid and all of that , but , how can i bind the txtRoleName in the modal with the role name of the row ? without any post back if its could happen or with post back if it's not .
here is my code
<asp:GridView ID="grdRoles"
CssClass="table table-bordered responsive"
runat="server"
GridLines="None"
CellSpacing="-1"
AutoGenerateColumns="False"
OnPageIndexChanging="grdRoles_PageIndexChanging"
OnRowDataBound="grdRoles_RowDataBound"
ShowFooter="True" ShowHeaderWhenEmpty="True" EmptyDataText="Empty !">
<Columns>
<asp:TemplateField HeaderText="#">
<ItemTemplate>
<asp:Label ID="lblRank" runat="server" Text='<%# Container.DataItem %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Roles">
<ItemTemplate>
<asp:Label ID="lblRoleName" runat="server" Text='<%# Container.DataItem %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Action">
<ItemTemplate>
<asp:LinkButton ID="btnEdit" data-toggle="modal" href="#EditModal" runat="server" CssClass="btn icon-edit" />
<asp:LinkButton ID="btnRemove" runat="server" CssClass="btn btn-danger remove" Text="icon-remove">" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
这里是模态
and here is the modal
<div id="EditModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="Edit"
aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="helpModalLabel"> Edit Role</h3>
</div>
<div class="modal-body">
<div class="control-group">
<div class="controls">
<div class="input-prepend">
<span class="add-on">Role Name</span>
<asp:TextBox ID="txtRoleName" Text='<%# Bind("RoleId") %>' runat="server"></asp:TextBox>
</div>
</div>
<div class="form-actions">
<asp:Button ID="btnSave" type="submit" class="btn btn-primary" runat="server" Text="Save" />
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
</div>
</div>
image of the grid
Grid[]
Modal : Modal[]
thanks in advance
推荐答案
而不是这个
instead of this
<asp:linkbutton id="btnEdit" data-toggle="modal" href="#EditModal" runat="server" cssclass="btn icon-edit" xmlns:asp="#unknown" />
使用此
use this
<asp:linkbutton id="btnEdit" data-toggle="modal" data-target="#EditModal" runat="server" cssclass="btn icon-edit" xmlns:asp="#unknown" />
这篇关于从Gridview Edit Linkbutton填充bootstrap模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文