Salve, sto provando ad usare le FormView, però quando cerco di inserire un nuovo record questo viene registrato ma, tranne un campo che prende il valore da una querystringfield, gli altri sono registrati NULL. Cosa sbaglio?
di seguito il codice che sto utilizzando:

<asp:ScriptManager id="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel id="UpdatePanel1" runat="server">
<ContentTemplate>
<table style="width: 100%; height: 500px">
<tr>
<td style="width: 23px; height: 22px;"></td>
<td style="height: 22px; width: 925px;" class="auto-style1">
<asp:Label id="LabelID" runat="server" CssClass="auto-style6" Font-Names="Tekton Pro Ext" Font-Size="Medium" Visible="False"></asp:Label>
</td>
<td style="height: 22px;"></td>
</tr>
<tr>
<td style="height: 391px; width: 23px;" >
</td>
<td style="width: 925px; height: 391px">
<table style="width: 100%; height: 395px;">
<tr>
<td style="height: 40px">
<br />
<asp:FormView ID="FormView1" runat="server" DataSourceID="SqlDataSource1" EnableModelValidation="False">
<InsertItemTemplate>
IDIndirizzo:
<asp:TextBox ID="IDIndirizzoTextBox" runat="server" Text="<%# LabelID.Text%>" />
<br />
Cognome:
<asp:TextBox ID="CognomeTextBox" runat="server" />
<br />
Nome:
<asp:TextBox ID="NomeTextBox" runat="server" />
<br />
Funzione:
<asp:TextBox ID="FunzioneTextBox" runat="server" />
<br />
Tel1:
<asp:TextBox ID="Tel1TextBox" runat="server" />
<br />
Tel2:
<asp:TextBox ID="Tel2TextBox" runat="server" />
<br />
Tel3:
<asp:TextBox ID="Tel3TextBox" runat="server" />
<br />
IndirizzoPostaElettronica:
<asp:TextBox ID="IndirizzoPostaElettronicaTextBox" runat="server" />
<br />
<asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" Text="Inserisci" />
&nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Annulla" />
</InsertItemTemplate>
<ItemTemplate>
IDIndirizzo:
<asp:Label ID="IDIndirizzoTextBox" runat="server" Text='<%# Bind("IDIndirizzo") %>' />
<br />
Cognome:
<asp:Label ID="CognomeTextBox" runat="server" Text='<%# Bind("Cognome") %>' />
<br />
Nome:
<asp:Label ID="NomeTextBox" runat="server" Text='<%# Bind("Nome") %>' />
<br />
Funzione:
<asp:Label ID="FunzioneTextBox" runat="server" Text='<%# Bind("Funzione") %>' />
<br />
Tel1:
<asp:Label ID="Tel1TextBox" runat="server" Text='<%# Bind("Tel1") %>' />
<br />
Tel2:
<asp:Label ID="Tel2TextBox" runat="server" Text='<%# Bind("Tel2") %>' />
<br />
Tel3:
<asp:Label ID="Tel3TextBox" runat="server" Text='<%# Bind("Tel3") %>' />
<br />
IndirizzoPostaElettronica:
<asp:Label ID="IndirizzoPostaElettronicaTextBox" runat="server" Text='<%# Bind("IndirizzoPostaElettronica") %>' />
<br />
IdUnivoco:
<asp:Label ID="IdUnivocoTextBox" runat="server" Text='<%# Eval("IdUnivoco") %>' />
<br />
<asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" CommandName="New" Text="Nuovo" />
</ItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:QualitaMMsrlConnectionString %>" InsertCommand="INSERT INTO T_RubricaDettaglioAzienda(IDIndirizzo, Cognome, Nome, Funzione, Tel1, Tel2, Tel3, IndirizzoPostaElettronica) VALUES (@IDIndirizzoTextBox, @CognomeTextBox, @NomeTextBox, @FunzioneTextBox, @Tel1TextBox, @Tel2TextBox, @Tel3TextBox, @IndirizzoPostaElettronicaTextBox)" SelectCommand="SELECT IDIndirizzo, Cognome, Nome, Funzione, Tel1, Tel2, Tel3, IndirizzoPostaElettronica, IdUnivoco FROM T_RubricaDettaglioAzienda" ">
<InsertParameters>
<asp:QueryStringParameter Name="IDIndirizzoTextBox" QueryStringField="xId" />
<asp:ControlParameter ControlID="FormView1" Name="CognomeTextBox" PropertyName="SelectedValue" />
<asp:ControlParameter ControlID="FormView1" Name="NomeTextBox" PropertyName="SelectedValue" />
<asp:ControlParameter ControlID="FormView1" Name="FunzioneTextBox" PropertyName="SelectedValue" />
<asp:ControlParameter ControlID="FormView1" Name="Tel1TextBox" PropertyName="SelectedValue" />
<asp:ControlParameter ControlID="FormView1" Name="Tel2TextBox" PropertyName="SelectedValue" />
<asp:ControlParameter ControlID="FormView1" Name="Tel3TextBox" PropertyName="SelectedValue" />
<asp:ControlParameter ControlID="FormView1" Name="IndirizzoPostaElettronicaTextBox" PropertyName="SelectedValue" />
</InsertParameters>
</asp:SqlDataSource>
</td>
</tr>
</table>
</td>
<td style="height: 391px"></td>
</tr>
<tr>
<td style="width: 23px" >
&nbsp;</td>
<td style="width: 925px">
&nbsp;</td>
<td >
&nbsp;</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>

Torna al forum | Feed RSS

ASPItalia.com non è responsabile per il contenuto dei messaggi presenti su questo servizio, non avendo nessun controllo sui messaggi postati nei propri forum, che rappresentano l'espressione del pensiero degli autori.