aggiunta anag fasi (funziona insert e delete)
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/WebMasterPages/AjaxSimpleFull.Master" AutoEventWireup="true" CodeBehind="AnagFasi.aspx.cs" Inherits="ETS_WS.AnagFasi" %>
|
||||
<%@ Register src="WebUserControls/mod_anagFasi.ascx" tagname="mod_anagFasi" tagprefix="uc1" %>
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
|
||||
<uc1:mod_anagFasi ID="mod_anagFasi1" runat="server" />
|
||||
</asp:Content>
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace ETS_WS
|
||||
{
|
||||
public partial class AnagFasi : System.Web.UI.Page
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+24
@@ -0,0 +1,24 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace ETS_WS {
|
||||
|
||||
|
||||
public partial class AnagFasi {
|
||||
|
||||
/// <summary>
|
||||
/// mod_anagFasi1 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::ETS_WS.WebUserControls.mod_anagFasi mod_anagFasi1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_anagFasi.ascx.cs"
|
||||
Inherits="ETS_WS.WebUserControls.mod_anagFasi" %>
|
||||
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
|
||||
<asp:GridView ID="grView" runat="server" CellPadding="4" DataSourceID="ods" ForeColor="#333333"
|
||||
GridLines="None" AllowSorting="True" AutoGenerateColumns="False"
|
||||
Width="100%" DataKeyNames="idxFase">
|
||||
<AlternatingRowStyle BackColor="White" />
|
||||
<EditRowStyle BackColor="#2461BF" />
|
||||
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
|
||||
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
|
||||
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
|
||||
<RowStyle BackColor="#EFF3FB" />
|
||||
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
|
||||
<SortedAscendingCellStyle BackColor="#F5F7FB" />
|
||||
<SortedAscendingHeaderStyle BackColor="#6D95E1" />
|
||||
<SortedDescendingCellStyle BackColor="#E9EBEF" />
|
||||
<SortedDescendingHeaderStyle BackColor="#4870BE" />
|
||||
<Columns>
|
||||
<asp:TemplateField ShowHeader="False" ItemStyle-HorizontalAlign="Center">
|
||||
<HeaderTemplate>
|
||||
<asp:ImageButton ID="imgBtnReset" runat="server" ToolTip="Reset" CausesValidation="False"
|
||||
OnClick="btnReset_Click" ImageUrl="~/images/reload_l.png" Visible="true" />
|
||||
</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:ImageButton ID="imgSelect" runat="server" CausesValidation="False" CommandName="Select"
|
||||
ToolTip="Select" ImageUrl="~/images/view_m.png" />
|
||||
<asp:ImageButton ID="imgEdit" runat="server" CausesValidation="False" CommandName="Edit"
|
||||
ToolTip="Edit" ImageUrl="~/images/edit_m.png" />
|
||||
</ItemTemplate>
|
||||
<EditItemTemplate>
|
||||
<asp:ImageButton ID="imgUpdate" runat="server" CausesValidation="False" CommandName="Update"
|
||||
ToolTip="Update" ImageUrl="~/images/apply_m.png" />
|
||||
<asp:ImageButton ID="imgCancel" runat="server" CausesValidation="False" CommandName="Cancel"
|
||||
ToolTip="Cancel" ImageUrl="~/images/cancel_m.png" />
|
||||
</EditItemTemplate>
|
||||
<FooterTemplate>
|
||||
<asp:ImageButton ID="imgInsert" runat="server" CausesValidation="False" CommandName="Insert"
|
||||
ToolTip="insert" ImageUrl="~/images/new_m.png" OnClick="lblIns_click" />
|
||||
<asp:ImageButton ID="imgCancel" runat="server" CausesValidation="False" CommandName="Cancel"
|
||||
ToolTip="Cancel" ImageUrl="~/images/cancel_m.png" />
|
||||
</FooterTemplate>
|
||||
<ItemStyle HorizontalAlign="Center"></ItemStyle>
|
||||
</asp:TemplateField>
|
||||
|
||||
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="cod." SortExpression="codFase">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="lblCodFase" runat="server" Text='<%# Eval("codFase") %>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
<EditItemTemplate>
|
||||
<asp:TextBox ID="txtCodFase" runat="server" Text='<%# Bind("codFase") %>'></asp:TextBox>
|
||||
</EditItemTemplate>
|
||||
<FooterTemplate>
|
||||
<asp:TextBox ID="txtCodFase" runat="server" Text='<%# Bind("codFase") %>'></asp:TextBox>
|
||||
</FooterTemplate>
|
||||
|
||||
<ItemStyle HorizontalAlign="Center"></ItemStyle>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="descrizione" SortExpression="descrizione">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="lblDescrizione" runat="server" Text='<%# Eval("descrizione") %>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
<EditItemTemplate>
|
||||
<asp:TextBox ID="txtDescrizione" runat="server" Text='<%# Bind("descrizione") %>'></asp:TextBox>
|
||||
</EditItemTemplate>
|
||||
<FooterTemplate>
|
||||
<asp:TextBox ID="txtDescrizione" runat="server" Text='<%# Bind("descrizione") %>'>
|
||||
</asp:TextBox>
|
||||
</FooterTemplate> </asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="Folder Name" SortExpression="folderName">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="lblFolderName" runat="server" Text='<%# Eval("folderName") %>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
<EditItemTemplate>
|
||||
<asp:TextBox ID="txtFolderName" runat="server" Text='<%# Bind("folderName") %>'></asp:TextBox>
|
||||
</EditItemTemplate>
|
||||
<FooterTemplate>
|
||||
<asp:TextBox ID="txtFolderName" runat="server" Text='<%# Bind("folderName") %>'></asp:TextBox>
|
||||
</FooterTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField ShowHeader="False">
|
||||
<HeaderTemplate>
|
||||
<asp:Button ID="btnNew" runat="server" OnClick="btnNew_Click" Text="New" />
|
||||
</HeaderTemplate>
|
||||
<EditItemTemplate>
|
||||
<asp:ImageButton ID="imgUpdate2" runat="server" CausesValidation="False" CommandName="Update"
|
||||
ImageUrl="~/images/apply_m.png" ToolTip="Update" />
|
||||
<asp:ImageButton ID="imgCancel2" runat="server" CausesValidation="False" CommandName="Cancel"
|
||||
ImageUrl="~/images/cancel_m.png" ToolTip="Cancel" />
|
||||
</EditItemTemplate>
|
||||
<FooterTemplate>
|
||||
<asp:ImageButton ID="imgInsert2" runat="server" CausesValidation="False" CommandName="Insert"
|
||||
ImageUrl="~/images/new_m.png" OnClick="lblIns_click" ToolTip="insert" />
|
||||
<asp:ImageButton ID="imgCancel2" runat="server" CausesValidation="False" CommandName="Cancel"
|
||||
ImageUrl="~/images/cancel_m.png" ToolTip="Cancel" />
|
||||
</FooterTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:ImageButton ID="imgDelete" runat="server" CausesValidation="False" CommandArgument='<%# Eval("idxFase") %>'
|
||||
CommandName="Delete" ImageUrl="~/images/elimina_m.png" ToolTip="Delete" Visible='<%# delEnabled(Eval("folderName")) %>' />
|
||||
<asp:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" ConfirmText="Sei sicuro di voler eliminare il record?"
|
||||
TargetControlID="imgDelete">
|
||||
</asp:ConfirmButtonExtender>
|
||||
</ItemTemplate>
|
||||
<ItemStyle HorizontalAlign="Center" />
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
<asp:ObjectDataSource ID="ods" runat="server" DeleteMethod="DeleteQuery" InsertMethod="Insert"
|
||||
OldValuesParameterFormatString="Original_{0}" SelectMethod="GetData" TypeName="ETS_Data.DS_WebScipTableAdapters.AnagFasiTableAdapter"
|
||||
UpdateMethod="Update" OnInserting="recuperaFooter"
|
||||
ondeleted="ods_Deleted" onupdated="ods_Updated">
|
||||
<DeleteParameters>
|
||||
<asp:Parameter Name="Original_idxFase" Type="Int32" />
|
||||
</DeleteParameters>
|
||||
<InsertParameters>
|
||||
<asp:Parameter Name="codFase" Type="String" />
|
||||
<asp:Parameter Name="descrizione" Type="String" />
|
||||
<asp:Parameter Name="folderName" Type="String" />
|
||||
</InsertParameters>
|
||||
<UpdateParameters>
|
||||
<asp:Parameter Name="codFase" Type="String" />
|
||||
<asp:Parameter Name="descrizione" Type="String" />
|
||||
<asp:Parameter Name="folderName" Type="String" />
|
||||
<asp:Parameter Name="Original_idxFase" Type="Int32" />
|
||||
</UpdateParameters>
|
||||
</asp:ObjectDataSource>
|
||||
@@ -0,0 +1,103 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using ETS_Data;
|
||||
|
||||
namespace ETS_WS.WebUserControls
|
||||
{
|
||||
public partial class mod_anagFasi : System.Web.UI.UserControl
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// reset della selezione
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnReset_Click(object sender, EventArgs e)
|
||||
{
|
||||
resetSelezione();
|
||||
}
|
||||
/// <summary>
|
||||
/// resetta la selezione dei valori in caso di modifiche su altri controlli
|
||||
/// </summary>
|
||||
public void resetSelezione()
|
||||
{
|
||||
grView.SelectedIndex = -1;
|
||||
grView.DataBind();
|
||||
}
|
||||
/// <summary>
|
||||
/// inserisce nuovo valore da footer
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void lblIns_click(object sender, EventArgs e)
|
||||
{
|
||||
// click su inserimento, chiamo il metodo insert dell'ObjectDataSource
|
||||
ods.Insert();
|
||||
}
|
||||
/// <summary>
|
||||
/// gestione evento richeista nuovo valore (mostra footer, ...)
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnNew_Click(object sender, EventArgs e)
|
||||
{
|
||||
// reset selezione...
|
||||
resetSelezione();
|
||||
// mostro il footer oppure la riga dei dettagli x nuovo...
|
||||
if (grView.FooterRow != null)
|
||||
{
|
||||
grView.FooterRow.Visible = true;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// determina se sia eliminabile il record (=non usato)
|
||||
/// </summary>
|
||||
/// <param name="idxMaker"></param>
|
||||
/// <returns></returns>
|
||||
public bool delEnabled(object idxObj)
|
||||
{
|
||||
bool answ = true;
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// recupera i dati di un nuovo record contenuti nel footer di un gridView;
|
||||
/// questi devono esses opportunamente nominati (es: txt{0}, dl{0}, ...)
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void recuperaFooter(object sender, ObjectDataSourceMethodEventArgs e)
|
||||
{
|
||||
// leggo i valori!
|
||||
e.InputParameters["codFase"] = ((TextBox)grView.FooterRow.FindControl("txtCodFase")).Text.Substring(0, 2);
|
||||
e.InputParameters["descrizione"] = ((TextBox)grView.FooterRow.FindControl("txtDescrizione")).Text;
|
||||
e.InputParameters["folderName"] = ((TextBox)grView.FooterRow.FindControl("txtFolderName")).Text;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// refresh post edit
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void ods_Updated(object sender, ObjectDataSourceStatusEventArgs e)
|
||||
{
|
||||
grView.DataBind();
|
||||
}
|
||||
/// <summary>
|
||||
/// refresh post delete
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void ods_Deleted(object sender, ObjectDataSourceStatusEventArgs e)
|
||||
{
|
||||
grView.DataBind();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace ETS_WS.WebUserControls {
|
||||
|
||||
|
||||
public partial class mod_anagFasi {
|
||||
|
||||
/// <summary>
|
||||
/// grView control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.GridView grView;
|
||||
|
||||
/// <summary>
|
||||
/// ods control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.ObjectDataSource ods;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user