<pre lang="xml"><asp:Button ID="btnShowPopup" runat="server" style="display:none" /> <asp:ModalPopupExtender ID="mdlPopup" runat="server" TargetControlID="btnShowPopup" PopupControlID="pnlPopup" CancelControlID="btnClose" BackgroundCssClass="modalBackground" /> <asp:Panel ID="pnlPopup" runat="server" CssClass="detail" Width="500px"> <asp:UpdatePanel ID="updPnlStockDetail" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:Label ID="lblStockDetail" runat="server" Text="Detail" BackColor="#7AB800" Width="95%" /> <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" OnItemUpdated="DetailsView1_ItemUpdated" BackColor="White" Width="95%" FieldHeaderStyle-Width="200px" OnDataBound="DetailsView1_DataBound" OnItemCommand="DetailsView1_ItemCommand"> <FieldHeaderStyle Width="200px" /> <Fields> </pre> </Fields> </asp:DetailsView> </ContentTemplate> </asp:UpdatePanel> <div align="right" style="width:95%"> <asp:Button ID="btnEdit" runat="server" Text="Edit" CommandName="Edit" Height="26px" Width="50px" BackColor="#7AB800" CssClass="viewdetailbutton" /> <asp:Button ID="btnClose" runat="server" Text="Close" CommandName="Close" Height="26px" Width="50px" BackColor="#FF9900" CssClass="viewdetailbutton" /> </div> </asp:Panel>
protected void DetailsView1_ItemCommand(object sender, DetailsViewCommandEventArgs e) { if (e.CommandName == "Edit") { this.DetailsView1.ChangeMode(DetailsViewMode.Edit); this.DetailsView1.DataBind(); } else if (e.CommandName == "Close") { this.DetailsView1.ChangeMode(DetailsViewMode.ReadOnly); this.DetailsView1.DataBind(); } }
ItemCommand
DetailsView
Click
protected void BtnEdit_OnClick(object sender, EventArgs e) { DetailsView1.ChangeMode(DetailsViewMode.Edit); DetailsView1.DataBind(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)