1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
| <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI" TagPrefix="asp" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Gestion d'assurance</title>
<link type="text/css" href="datagrid.css" rel="stylesheet" />
<link type="text/css" href="detailgrid.css" rel="stylesheet" />
</head>
<body>
<form id="form1" runat="server">
<!--=============================================================================================================================================================================-->
<asp:ScriptManager ID="ScriptManager1" runat="server"/>
<script type="text/javascript" language="javascript">
// attach to the pageLoaded event
Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(pageLoaded);
function pageLoaded(sender, args) {
// the data key is the control's ID
var dataKey = '<%= this.gvCustomers.ClientID %>';
var updatedRowIndex = args.get_dataItems()[dataKey];
// if there is a datakey for the grid, use it to
// identify the row that was updated
if(updatedRowIndex){
// get the row that was updated
var tr = $get(dataKey).rows[parseInt(updatedRowIndex) + 1];
// add the 'updated' css class
Sys.UI.DomElement.addCssClass(tr, 'updated');
// remove the css class in 1.5 seconds
window.setTimeout(function(){
Sys.UI.DomElement.removeCssClass(
tr,
'updated'
);
}, 1500);
}
}
</script>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
SelectCommand="SELECT [idCategorie], [Categorie] FROM [Categorie]"
SelectCommandType="Text" ConnectionString="<%$ ConnectionStrings:ASSURANCEConnectionString %>" />
<asp:SqlDataSource ID="SqlDataSourceDetail" runat="server"
SelectCommand="SELECT [idCategorie], [Categorie] FROM [Categorie] where idCategorie=@idCategorie"
SelectCommandType="Text" CancelSelectOnNullParameter="true" ConnectionString="<%$ ConnectionStrings:ASSURANCEConnectionString %>">
<SelectParameters>
<asp:Parameter Name="idCategorie" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
<asp:UpdatePanel ID="updatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="gvCustomers" runat="server" DataSourceID="SqlDataSource1"
CssClass="datagrid" GridLines="None" AutoGenerateColumns="false"
OnSelectedIndexChanged="GvCustomers_SelectedIndexChanged" DataKeyNames="idCategorie">
<Columns>
<asp:BoundField DataField="idCategorie" HeaderText="ID" ReadOnly="true" />
<asp:BoundField DataField="Categorie" HeaderText="Categorie" ReadOnly="true" />
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="btnViewDetails" runat="server" Text="Edit" CommandName="Select" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
<asp:Panel ID="Panel1" runat="server" CssClass="detail" Width="500px" style="display:none;">
<asp:UpdatePanel ID="updPnlCustomerDetail" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Button id="btnShowPopup" runat="server" style="display:none" />
<asp:ModalPopupExtender ID="mdlPopup" runat="server"
TargetControlID="btnShowPopup" PopupControlID="pnlPopup"
CancelControlID="btnClose" BackgroundCssClass="modalBackground"
/>
<asp:DetailsView ID="dvCustomerDetail" runat="server" DataSourceID="SqlDataSourceDetail"
CssClass="detailgrid" GridLines="None" DefaultMode="Edit" AutoGenerateRows="false"
Visible="false" Width="100%">
<Fields>
<asp:BoundField HeaderText="ID" DataField="idCategorie" ReadOnly="true" />
<asp:TemplateField HeaderText="Categorie">
<EditItemTemplate>
<asp:TextBox ID="txtCategorie" runat="server" Text='<%# Bind("Categorie") %>' />
<asp:RequiredFieldValidator ID="rfvCategorie" runat="server" ControlToValidate="txtCategorie" ErrorMessage="Required" Display="Static" SetFocusOnError="true" />
</EditItemTemplate>
</asp:TemplateField>
</Fields>
</asp:DetailsView>
<div class="footer">
<asp:LinkButton ID="btnSave" runat="server"
Text="Save" OnClick="BtnSave_Click" CausesValidation="true"
/>
<asp:LinkButton ID="LinkButton1" runat="server"
Text="Close" CausesValidation="false"
/>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
<!--=============================================================================================================================================================================-->
</form>
</body>
</html> |
Partager