Tema: Guardar
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/02/2013, 04:13
maialenlopez
 
Fecha de Ingreso: abril-2012
Mensajes: 449
Antigüedad: 12 años, 1 mes
Puntos: 7
Exclamación Guardar

Hola ;
Estoy creando una aplicacion web que conecta con base de datos. Como veréis en el código .aspx que pondré mas abajo (no estan incluidos todos los conceptos), me han pedido que haga un .aspx que tenga 31 CONCEPTOS.

Código aspx:
Ver original
  1. <!--CONCEPTO 1-->
  2.     <asp:Label ID="Concepto1" runat="server" Text=" CONCEPTO " Font-Size="Medium"></asp:Label>
  3.     <p>
  4.         <asp:DropDownList ID="ComboConceptosV1" runat="server" Height="25px"
  5.             Width="175px" AutoPostBack="True">
  6.         </asp:DropDownList>
  7.         &nbsp;
  8.         <asp:Label ID="Label1" runat="server" Text="Descripción: "></asp:Label>
  9.         <asp:TextBox ID="TextDescripcionV1" runat="server" BackColor="#CCCCCC"
  10.             Width="190px"></asp:TextBox>
  11.         &nbsp;
  12.         <asp:Label ID="Facturable1" runat="server" Text="Facturable: "></asp:Label>
  13.         <asp:RadioButtonList ID="RadioButtonFacturableV1" runat="server" AutoPostBack="True" RepeatDirection="Horizontal" RepeatLayout="Flow" CellPadding="-1" Enabled="False">
  14.             <asp:ListItem Value="1">SI</asp:ListItem>
  15.             <asp:ListItem Value="2">NO</asp:ListItem>
  16.         </asp:RadioButtonList>
  17.         <asp:Label ID="Label2" runat="server" ForeColor="Red" Font-Bold="True"></asp:Label>
  18.         &nbsp;
  19.         <asp:Label ID="Orden1" runat="server" Text="Orden: "></asp:Label>
  20.         <asp:TextBox ID="TextOrdenV1" runat="server" BackColor="#CCCCCC" Width="90px"
  21.             Enabled="True" AutoPostBack="True"></asp:TextBox>
  22.         &nbsp;
  23.         <asp:Label ID="Proyecto1" runat="server" Text="Proyecto: "></asp:Label>
  24.         <asp:TextBox ID="TextProyectoV1" runat="server" BackColor="#CCCCCC" Width="80px"
  25.             Enabled="True" AutoPostBack="True"></asp:TextBox>
  26.         &nbsp;
  27.         <asp:Label ID="Importe1" runat="server" Text="Importe: "></asp:Label>
  28.         <asp:TextBox ID="TextImporteV1" runat="server" BackColor="#CCCCCC" Width="50px"
  29.             Enabled="True" AutoPostBack="True"></asp:TextBox>
  30.         <asp:Label ID="validacionImporteV1" runat="server" ForeColor="Red" Font-Bold="True"></asp:Label>
  31.         &nbsp;
  32.         <asp:Label ID="ElementoPep1" runat="server" Text="Elem.Pep: "></asp:Label>
  33.         <asp:TextBox ID="TextElementoPepV1" runat="server" BackColor="#CCCCCC" Width="40px"
  34.             Enabled="False" AutoPostBack="True"></asp:TextBox>
  35.     </p>
  36.    
  37.    ........
  38.    
  39.    
  40.     <!--CONCEPTO 31-->
  41.     <asp:Label ID="Concepto31" runat="server" Text=" CONCEPTO " Font-Size="Medium"></asp:Label>
  42.     <p>
  43.         <asp:DropDownList ID="ComboConceptosV31" runat="server" Height="25px"
  44.             Width="175px" AutoPostBack="True">
  45.         </asp:DropDownList>
  46.         &nbsp;
  47.         <asp:Label ID="Label176" runat="server" Text="Descripción: "></asp:Label>
  48.         <asp:TextBox ID="TextDescripcionV31" runat="server" BackColor="#CCCCCC" Width="190px"></asp:TextBox>
  49.         &nbsp;
  50.         <asp:Label ID="Label178" runat="server" Text="Facturable: "></asp:Label>
  51.         <asp:RadioButtonList ID="RadioButtonFacturableV31" runat="server" AutoPostBack="True" RepeatDirection="Horizontal" RepeatLayout="Flow" CellPadding="-1" Enabled="False">
  52.             <asp:ListItem Value="1">SI</asp:ListItem>
  53.             <asp:ListItem Value="2">NO</asp:ListItem>
  54.         </asp:RadioButtonList>
  55.         &nbsp;
  56.         <asp:Label ID="Label179" runat="server" Text="Orden: "></asp:Label>
  57.         <asp:TextBox ID="TextOrdenV31" runat="server" BackColor="#CCCCCC" Width="90px"
  58.             Enabled="True" AutoPostBack="True"></asp:TextBox>
  59.         &nbsp;
  60.         <asp:Label ID="Label180" runat="server" Text="Proyecto: "></asp:Label>
  61.         <asp:TextBox ID="TextProyectoV31" runat="server" BackColor="#CCCCCC" Width="80px"
  62.             Enabled="True" AutoPostBack="True"></asp:TextBox>
  63.         &nbsp;
  64.         <asp:Label ID="Label181" runat="server" Text="Importe: "></asp:Label>
  65.         <asp:TextBox ID="TextImporteV31" runat="server" BackColor="#CCCCCC" Width="50px"
  66.             Enabled="True" AutoPostBack="True"></asp:TextBox>
  67.         <asp:Label ID="validacionInporteV31" runat="server" ForeColor="Red" Font-Bold="True"></asp:Label>
  68.         &nbsp;
  69.         <asp:Label ID="Label183" runat="server" Text="Elem.Pep: "></asp:Label>
  70.         <asp:TextBox ID="TextElementoPepV31" runat="server" BackColor="#CCCCCC" Width="40px"
  71.             Enabled="False" AutoPostBack="True"></asp:TextBox>
  72.     </p>
  73.     <asp:Table ID="Table28" runat="server" BorderColor="White" CellPadding="2"
  74.         CellSpacing="5"  Width="1056px">
  75.         <asp:TableRow Font-Bold="True" Font-Overline="False">
  76.             <asp:TableCell ID="CellTotGastosV" Font-Names="Arial Black" HorizontalAlign="Right" Enabled="False" Width="1000px" Font-Size="Medium">TOTAL GASTOS</asp:TableCell>
  77.             <asp:TableCell ID="CellTotGastosCantiV" HorizontalAlign="Left" Enabled="False">
  78.                 <asp:TextBox ID="TextTotGastosCantiV" runat="server" BackColor="Gray" Width="150px" maxlength="10" ForeColor="White" Font-Bold="True"></asp:TextBox>
  79.             </asp:TableCell>
  80.         </asp:TableRow>
  81.     </asp:Table>            
  82.     <asp:Table ID="Table29" runat="server" BorderColor="White" CellPadding="2" CellSpacing="5"  Width="1100px">
  83.         <asp:TableRow Enabled="False" Font-Bold="True" Font-Names="Arial Black" Font-Overline="False">
  84.             <asp:TableCell ID="TableCell8" HorizontalAlign="Left">OBSERVACIONES:</asp:TableCell>
  85.         </asp:TableRow>
  86.         <asp:TableRow Font-Bold="True" Font-Names="Arial" Font-Overline="False">
  87.             <asp:TableCell ID="TableCell9" HorizontalAlign="Left" Enabled="True">
  88.                 <asp:TextBox ID="TextObservacionesV" runat="server" BackColor="#CCCCCC" Width="1040px" maxlength="500" Height="100px" TextMode="MultiLine"></asp:TextBox>
  89.             </asp:TableCell>
  90.         </asp:TableRow>
  91.     </asp:Table>
  92.      <asp:Table ID="Table31" runat="server" BorderColor="White" CellPadding="2"
  93.         CellSpacing="5"  Width="1050px">
  94.         <asp:TableRow Font-Bold="True" Font-Overline="False">
  95.             <asp:TableCell ID="TableCell31" HorizontalAlign="Right" Font-Size="Small" Width="390px">AUTORIZADO POR:</asp:TableCell>
  96.             <asp:TableCell ID="TableCell32" HorizontalAlign="Right">
  97.                 <asp:TextBox ID="TextBox31" runat="server" Width="350px" maxlength="70" Font-Bold="True"></asp:TextBox>
  98.             </asp:TableCell>
  99.             <asp:TableCell ID="TableCell33" HorizontalAlign="Right" Enabled="False">
  100.                 <asp:TextBox ID="TextBox32" runat="server" Width="200px" ForeColor="White" Font-Bold="True" Height="40px"></asp:TextBox>
  101.             </asp:TableCell>
  102.             <asp:TableCell ID="TableCell7" HorizontalAlign="Left" Enabled="True">
  103.                 <asp:Button Runat="server" ID="BtnGuardarV" Text=" Guardar "></asp:Button>
  104.             </asp:TableCell>
  105.         </asp:TableRow>
  106.     </asp:Table>
  107.     <asp:Table ID="Table30" runat="server" BorderColor="White" CellPadding="2" CellSpacing="5"  Width="1200px">
  108.         <asp:TableRow Font-Bold="True" Font-Overline="False">
  109.             <asp:TableCell ID="CellValidacion" HorizontalAlign="Left" Enabled="True" Width="800px">
  110.                 <asp:Label ID="Validacion4" runat="server" ForeColor="Red"></asp:Label>
  111.                 <asp:Label ID="Validacion5" runat="server" ForeColor="Red"></asp:Label>
  112.             </asp:TableCell>
  113.         </asp:TableRow>
  114.     </asp:Table>  
  115. </asp:Content>

Al hacer page_load tengo que ocultar todos los conceptos menos el concepto 1 y cuando meta el importe del concepto 1, se pondrá visible todo lo del concepto 2 y así sucesivamente.

Al darle al botón guardar, guardara en la base de datos el contenido de la hoja.

Pero no siempre tengo que guardar el contenido de los 31 conceptos ya que la mayoría de veces no estarán todos visibles. Algunas veces solo habrá datos en los primeros 3 conceptos y solo tendría que guardar el contenido de estos.

¿Como podría hacerlo sin tener que guardar siempre los 31 conceptos, la mayoria con valores nulos?

Gracias, espero que me ayuden ya que necesito solucionarlo cuanto antes y a mi no se me ocurre nada.
__________________
Gracias por todo;

Un saludo