我想分配
<%# DataBinder.Eval(Container.DataItem, "Name")%>
在gridview中的标签
Label2
在gridview之外。我不知道如何做到这一点,因为Eval值在Gridview和我之内 需要在gridview之外使用它。我有以下代码。
请告诉我。
<div class="ModalPopup" id="PopupDiv1">
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<table>
<tr>
<td>
<div class="modalHeader">
<table width="100%">
<tr>
<td class="title">
<asp:Label ID="Label2" Font-Bold="true" runat="server"></asp:Label>
</td>
<td>
<a href="javascript:void(0);" onclick="javascript:CloseModelPopup1();" class="CloseModal">
X</a>
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td>
<div id="Div1" class="InsertBar">
<asp:Panel ID="Panel1" runat="server" HorizontalAlign="left" ScrollBars="Auto">
<asp:GridView ID="gDetails" OnRowDataBound="gvDetails_RowDataBound"
Orunat="server" CellPadding="5"
AutoGenerateColumns="false">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Image Width="32px" ID="statusImage" runat="server" Height="32px"></asp:Image>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="LogId">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "LogId") %>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Name">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "Name")%> </ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</asp:Panel>
</div>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</div>
答案 0 :(得分:0)
Try this out
<div class="ModalPopup" id="PopupDiv1">
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<table>
<tr>
<td>
<div class="modalHeader">
<table width="100%">
<tr>
<td class="title">
<asp:Label ID="Label2" Font-Bold="true" runat="server"></asp:Label>
</td>
<td>
<a href="javascript:void(0);" onclick="javascript:CloseModelPopup1();" class="CloseModal">
X</a>
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td>
<div id="Div1" class="InsertBar">
<asp:Panel ID="Panel1" runat="server" HorizontalAlign="left" ScrollBars="Auto">
<asp:GridView ID="gDetails" OnRowDataBound="gvDetails_RowDataBound"
Orunat="server" CellPadding="5"
AutoGenerateColumns="false">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Image Width="32px" ID="statusImage" runat="server" Height="32px"></asp:Image>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="LogId">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "LogId") %>
CommandArgument='<%# Container.DataItemIndex %>' runat="server" ID="btnRequest"></asp:LinkButton>--%>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Name">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "Name")%> </ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</asp:Panel>
</div>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</div>