Grazie infatti non lo volevo postare solo per "complessità", ma proviamoci lo stesso.
Questo è un update panel all'interno della pagina che da l'errore:
Codice PHP:
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="Label4" runat="server" Font-Names="Tahoma" Font-Size="14pt"
Text="Your USB key are not register, please contact us" Visible="False"></asp:Label>
<asp:Label ID="Label3" runat="server" Text="Please insert your USB key"
Visible="False" Font-Names="Tahoma" Font-Size="14pt"></asp:Label>
<asp:Label ID="Label1" runat="server" Text="Welcome "
Font-Names="Tahoma" Font-Size="14pt"></asp:Label>
<asp:Label ID="lblNometecnico" runat="server"
Font-Names="Tahoma" ForeColor="White" Font-Size="13pt" Font-Underline="True"></asp:Label>
<asp:Label ID="Label2" runat="server" Text=" select your language"
Font-Names="Tahoma" Font-Size="14pt"></asp:Label>
<asp:Timer ID="Timer1" onTick="Timer1_Tick" runat="server" Interval="1000" />
<div>
<asp:DropDownList ID="DropDownList1" runat="server" Width="100px"
AutoPostBack="True">
<asp:ListItem Text="ITALIANO" Value="IT"/>
<asp:ListItem Text="ENGLISH" Value="EN"/>
<asp:ListItem Text="FRANÇAIS" Value="FR"/>
</asp:DropDownList>
<asp:Button ID="ButtonReload" runat="server" Text="ENTER" ToolTip="Inserisci la chiave a corredo e clicca per ricaricare la pagina" OnClientClick="leggiChiave" Font-Size="Large" ForeColor="Black" />
<asp:HiddenField runat="server" ID="txtChiave" />
</div>
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False"
BackColor="#ECEEF0" BorderStyle="None"
CellPadding="4" DataSourceID="SqlTecnico" Height="50px" Width="125px">
<FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
<RowStyle BackColor="White" ForeColor="Black" Font-Italic="True" />
<PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
<Fields>
<asp:BoundField DataField="nome" HeaderText="Nome:" SortExpression="nome" />
<asp:BoundField DataField="cognome" HeaderText="Cognome:"
SortExpression="cognome" />
<asp:BoundField DataField="email" HeaderText="Email:" SortExpression="email" />
<asp:BoundField DataField="permessi" HeaderText="Permessi:"
SortExpression="permessi" />
<asp:BoundField DataField="chiavetta" HeaderText="Chiavetta:"
SortExpression="chiavetta" />
<asp:BoundField DataField="nome1" HeaderText="Centro Ass:"
SortExpression="nome1" />
<asp:BoundField DataField="lingua" HeaderText="Lingua:"
SortExpression="lingua" />
</Fields>
<HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />
<EditRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
</asp:DetailsView>
<asp:SqlDataSource ID="SqlTecnico" runat="server"
ConnectionString="<%$ ConnectionStrings:conn %>"
ProviderName="<%$ ConnectionStrings:conn.ProviderName %>"
SelectCommand="select tecnici.*,centri_assistenza.* from tecnici inner join centri_assistenza on tecnici.centro_assistenza=centri_assistenza.id where tecnici.id='ciccio'">
</asp:SqlDataSource>
<asp:Label ID="lblChiave" runat="server" Font-Names="Tahoma" Font-Size="14pt"
Visible="False"></asp:Label>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="ButtonReload" />
<asp:AsyncPostBackTrigger ControlID="DropDownList1"
EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
Questo è il codice lato server della stessa pagina:
Codice PHP:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Label1.Visible = False
Label3.Visible = True
Label2.Visible = False
lblNometecnico.Visible = False
End If
End Sub
Protected Sub Timer1_Tick(ByVal sender As Object, ByVal e As EventArgs) Handles Timer1.Tick
If txtChiave.Value.Length > 0 Then
If Common.ritorno.ToString = "niente" Or LCase(Common.ritorno.ToString) = "login.aspx" Then
calcolaEAspetta()
Else
entra()
End If
Else
Label1.Visible = False
Label3.Visible = True
Label2.Visible = False
lblNometecnico.Visible = False
DetailsView1.Visible = False
End If
Timer1.Enabled = False
End Sub
Protected Sub entra()
If txtChiave.Value.Length > 0 Then
Common.idChiave = txtChiave.Value
If Common.ritorno.ToString = "niente" Then
Response.Redirect(Common.homePage)
Else
Dim ritorno As String
ritorno = Common.ritorno
Common.ritorno = ""
Response.Redirect(ritorno)
End If
End If
End Sub
Protected Sub calcolaEAspetta()
If txtChiave.Value.Length > 0 Then
Label3.Visible = False
Label2.Visible = True
Label1.Visible = True
lblNometecnico.Visible = True
Common.idChiave = txtChiave.Value
SqlTecnico.SelectCommand = "select tecnici.*,centri_assistenza.* from tecnici left outer join centri_assistenza on tecnici.centro_assistenza=centri_assistenza.id where tecnici.id='" & Common.getInfoTecnico(Common.idChiave, "id") & "'"
DetailsView1.DataSourceID = "sqlTecnico"
lblNometecnico.Text = Common.getInfoTecnico(Common.idChiave, "nome")
DetailsView1.DataBind()
End If
End Sub
C'è poi una classe comune cntente le funzioni di utilizzo più intenso (Common.qualcosa):
Codice PHP:
Public Class Common
Public Shared loginPage = "login.aspx"
Public Shared homePage = "index.aspx"
Public Shared Property ritorno() As String
Get
If HttpContext.Current.Session("ritorno") Is Nothing Then
HttpContext.Current.Session("ritorno") = "niente"
End If
Return HttpContext.Current.Session("ritorno")
End Get
Set(ByVal value As String)
HttpContext.Current.Session("ritorno") = value
End Set
End Property
...
end class
...
Grazie intanto.