Saturday, March 24, 2012

DropDownList inside UpdatePanel

Dear All,

I have two DropDownList inside an UpdatePanel.

When I refresh the updatepanel the two DropDownList disappare for few second's, can I avoid it ?

Hi,

did you set the EnablePartialRendering attribute of the ScriptManager to "true"? If so, could you post the relevant code?

Yes EnablePartialRendering is set to true.

this is the code :

<%@. Page Language="VB" MasterPageFile="~/MasterPage.master" Title="Untitled Page" %>

<script runat="server">


Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
If Page.IsValid Then
If Page.IsValid Then


Dim stemp() As String
Dim ds As New WSUniprof.DScliente

Dim myrow As WSUniprof.DScliente.clienteRow = ds.cliente.NewclienteRow

myrow.Anagrafica = Me.TXRagioneSociale.Text.ToUpper.Trim
myrow.PartitaIva = Me.TXPartitaIva.Text.Trim
myrow.Indirizzo = Me.TXSedeLegale.Text.Trim

stemp = Me.DropDownList2.SelectedValue.Split("/")
If IsNumeric(stemp(0)) Then myrow.IDComune = stemp(0)

myrow.Cap = Me.TXCap.Text.ToString.Trim
myrow.Telefono = Me.TXTelefono.Text.ToString.Trim
myrow.Fax = Me.TXFax.Text.ToString.Trim
myrow.AltriTelefoni = Me.TXCellulare.Text.ToString.Trim
myrow.EMailInternet = Me.TXEmail.Text.Trim
myrow.IndirizzoS = Me.TXIndirizzoScarico.Text.Trim

stemp = Me.DropDownList4.SelectedValue.Split("/")
If IsNumeric(stemp(0)) Then myrow.IDComuneS = stemp(0)

myrow.CapS = Me.TXCapScarico.Text.ToString.Trim
myrow.TelefonoS = Me.TXTelefonoScarico.Text.ToString.Trim
myrow.FaxS = Me.TXFaxScarico.Text.ToString.Trim

ds.cliente.AddclienteRow(myrow)

Dim WEBserv As New WSUniprof.ClassCliente
' If WEBserv.IserimentoCliente(ds, Session("IDAnagrafica"), "malbec10") > 0 Then
Me.BloccaControlli()
Me.LabelCodiceCliente.Visible = True
Me.TXCodiceCliente.Visible = True
Me.TXCodiceCliente.Text = "12321"
System.Threading.Thread.Sleep(3000)
'Else

' End If

'SE PROVIENE DALLA PAGINA DI INSERIMENTO ORDINE
' If Request.QueryString("fromOrd") = "1" Then
'Response.Redirect("infoOrdine.aspx", False)
' Else
' Response.Redirect("default.aspx", False)
' End If
End If
End If
End Sub

Private Sub BloccaControlli()
Me.TXCap.Enabled = False
Me.TXCapScarico.Enabled = False
Me.TXCellulare.Enabled = False
Me.TXEmail.Enabled = False
Me.TXFax.Enabled = False
Me.TXFaxScarico.Enabled = False
Me.TXIndirizzoScarico.Enabled = False
Me.TXPartitaIva.Enabled = False
Me.TXPartitaIva.Enabled = False
Me.TXRagioneSociale.Enabled = False
Me.TXSedeLegale.Enabled = False
Me.TXRagioneSociale.Enabled = False
Me.TXSedeLegale.Enabled = False
Me.TXTelefono.Enabled = False
Me.TXTelefonoScarico.Enabled = False
Me.DropDownList1.Enabled = False
Me.DropDownList2.Enabled = False
Me.DropDownList3.Enabled = False
Me.DropDownList4.Enabled = False
Me.Label1.Enabled = False
Me.Label2.Enabled = False
Me.Label3.Enabled = False
Me.Label4.Enabled = False
Me.Label5.Enabled = False
Me.Label6.Enabled = False
Me.Label7.Enabled = False
Me.Label8.Enabled = False
Me.Label9.Enabled = False
Me.Label10.Enabled = False
Me.Label11.Enabled = False
Me.Label12.Enabled = False
Me.Label13.Enabled = False
Me.Label14.Enabled = False
Me.Label16.Enabled = False
Me.Label17.Enabled = False
Me.Label18.Enabled = False


End Sub
</script>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<script language="javascript" type="text/javascript">
function StartInsert(){
if (typeof(ValidatorOnSubmit) == "function" && ValidatorOnSubmit() == false){
$('ctl00$ContentPlaceHolder1$Button1').disabled = true;
}

}
</script>
<table border="0" cellpadding="0" cellspacing="0" style="width: 100%; height: 15px">
<tr>
<td align="center" style="width: 100%; height: 15px">
<asp:Label ID="Label1" runat="server" Text="Inserimento nuovo cliente"></asp:Label></td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" style="width: 100%; height: 400px">
<tr>
<td align="center" style="width: 100%; padding-top: 15px" valign="top">
<atlas:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<table border="0" cellpadding="0" cellspacing="0" style="width: 400px; height: 300px; border-right: activeborder 1px solid; border-top: activeborder 1px solid; border-left: activeborder 1px solid; border-bottom: activeborder 1px solid;">
<tr>
<td style="width: 200px; height: 15px" align="right">
<asp:Label ID="Label2" runat="server" Text="Ragione sociale"></asp:Label></td>
<td align="left" colspan="2" style="height: 15px">
<asp:TextBox ID="TXRagioneSociale" runat="server" Width="296px"></asp:TextBox></td>
</tr>
<tr>
<td align="right" style="width: 200px; height: 15px">
</td>
<td align="left" colspan="2" style="height: 15px">
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TXRagioneSociale"
Display="Dynamic" ErrorMessage="Ragione sociale richiesta"></asp:RequiredFieldValidator></td>
</tr>
<tr>
<td style="width: 200px; height: 15px" align="right">
<asp:Label ID="Label3" runat="server" Text="Sede legale"></asp:Label></td>
<td align="left" colspan="2" style="height: 15px">
<asp:TextBox ID="TXSedeLegale" runat="server" Width="296px"></asp:TextBox></td>
</tr>
<tr>
<td align="right" style="width: 200px; height: 15px">
</td>
<td align="left" colspan="2" style="height: 15px">
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="TXSedeLegale"
Display="Dynamic" ErrorMessage="Indirizzo sede legale richiesto"></asp:RequiredFieldValidator></td>
</tr>
<tr>
<td style="width: 200px; height: 15px" align="right">
<asp:Label ID="Label4" runat="server" Text="C.A.P."></asp:Label></td>
<td align="left" colspan="2" style="height: 15px">
<asp:TextBox ID="TXCap" runat="server" Width="80px"></asp:TextBox></td>
</tr>
<tr>
<td align="right" style="width: 200px; height: 15px">
</td>
<td align="left" colspan="2" style="height: 15px">
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="TXCap"
Display="Dynamic" ErrorMessage="Codice di avviamento postale richiesto"></asp:RequiredFieldValidator></td>
</tr>
<tr>
<td style="width: 200px; height: 15px" align="right">
<asp:Label ID="Label5" runat="server" Text="Provincia"></asp:Label></td>
<td align="left" colspan="2" style="height: 15px">
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" DataSourceID="ProvinciaDataSource"
DataTextField="NomeProvincia" DataValueField="IDProvincia">
<asp:ListItem Selected="True">Selezionare una provincia</asp:ListItem>
</asp:DropDownList>
<asp:ObjectDataSource ID="ProvinciaDataSource" runat="server" OldValuesParameterFormatString="original_{0}"
SelectMethod="GetData" TypeName="DataSet1TableAdapters.ProvinciaTableAdapter"></asp:ObjectDataSource>
</td>
</tr>
<tr>
<td align="right" style="width: 200px; height: 15px">
</td>
<td align="left" colspan="2" style="height: 15px">
</td>
</tr>
<tr>
<td style="width: 200px; height: 15px" align="right">
<asp:Label ID="Label6" runat="server" Text="Comune"></asp:Label></td>
<td align="left" colspan="2" style="height: 15px">
<asp:DropDownList ID="DropDownList2" runat="server" DataSourceID="ComuneDataSource"
DataTextField="Comune" DataValueField="IDComune">
</asp:DropDownList>
<asp:ObjectDataSource ID="ComuneDataSource" runat="server" OldValuesParameterFormatString="original_{0}"
SelectMethod="GetData" TypeName="DataSet1TableAdapters.ComuneTableAdapter">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList1" Name="IDProvincia" PropertyName="SelectedValue"
Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
</td>
</tr>
<tr>
<td align="right" style="width: 200px; height: 15px">
</td>
<td align="left" colspan="2" style="height: 15px">
</td>
</tr>
<tr>
<td style="width: 200px; height: 15px" align="right">
<asp:Label ID="Label7" runat="server" Text="Partita IVA"></asp:Label></td>
<td align="left" colspan="2" style="height: 15px">
<asp:TextBox ID="TXPartitaIva" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td align="right" style="width: 200px; height: 15px">
</td>
<td align="left" colspan="2" style="height: 15px">
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="TXPartitaIva"
Display="Dynamic" ErrorMessage="La partita IVA è incorretta" SetFocusOnError="True"
ValidationExpression="\d{11}"></asp:RegularExpressionValidator></td>
</tr>
<tr>
<td style="width: 200px; height: 15px" align="right">
<asp:Label ID="Label8" runat="server" Text="Telefono"></asp:Label></td>
<td align="left" colspan="2" style="height: 15px">
<asp:TextBox ID="TXTelefono" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td align="right" style="width: 200px; height: 15px">
</td>
<td align="left" colspan="2" style="height: 15px">
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="TXTelefono"
ErrorMessage="Il numero di telefono è richiesto"></asp:RequiredFieldValidator></td>
</tr>
<tr>
<td style="width: 200px; height: 15px" align="right">
<asp:Label ID="Label9" runat="server" Text="Fax"></asp:Label></td>
<td align="left" colspan="2" style="height: 15px">
<asp:TextBox ID="TXFax" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td align="right" style="width: 200px; height: 15px">
</td>
<td align="left" colspan="2" style="height: 15px">
</td>
</tr>
<tr>
<td style="width: 200px; height: 15px" align="right">
<asp:Label ID="Label10" runat="server" Text="Cellulare"></asp:Label></td>
<td align="left" colspan="2" style="height: 15px">
<asp:TextBox ID="TXCellulare" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td style="width: 200px; height: 15px" align="right">
</td>
<td align="left" colspan="2" style="height: 15px">
</td>
</tr>
<tr>
<td style="width: 200px; height: 15px" align="right">
<asp:Label ID="Label11" runat="server" Text="E-mail"></asp:Label></td>
<td align="left" colspan="2" style="height: 15px">
<asp:TextBox ID="TXEmail" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td align="right" style="width: 200px; height: 15px">
</td>
<td align="left" colspan="2" style="height: 15px">
<asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="TXEmail"
EnableViewState="False" ErrorMessage="L'indirizzo E-mail inserito non è corretto"
SetFocusOnError="True" ValidationExpression="\w+([-+.']\w+)*@.\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator></td>
</tr>
<tr>
<td align="left" colspan="3" style="height: 15px; background-color: buttonface">
<asp:Label ID="Label12" runat="server" Text="Luogo di scarico (non obbligatorio)"></asp:Label></td>
</tr>
<tr>
<td align="right" style="width: 200px; height: 15px">
<asp:Label ID="Label13" runat="server" Text="Indirizzo"></asp:Label></td>
<td align="left" colspan="2" style="height: 15px">
<asp:TextBox ID="TXIndirizzoScarico" runat="server" Width="296px"></asp:TextBox></td>
</tr>
<tr>
<td align="right" style="width: 200px; height: 15px">
</td>
<td align="left" colspan="2" style="height: 15px">
</td>
</tr>
<tr>
<td align="right" style="width: 200px; height: 15px">
<asp:Label ID="Label14" runat="server" Text="Provincia"></asp:Label></td>
<td align="left" colspan="2" style="height: 15px">
<asp:DropDownList ID="DropDownList3" runat="server" AutoPostBack="True" DataSourceID="ProvinciaDataSource"
DataTextField="NomeProvincia" DataValueField="IDProvincia">
<asp:ListItem Selected="True">Selezionare una provincia</asp:ListItem>
</asp:DropDownList></td>
</tr>
<tr>
<td align="right" style="width: 200px; height: 15px">
</td>
<td align="left" colspan="2" style="height: 15px">
</td>
</tr>
<tr>
<td align="right" style="width: 200px; height: 15px">
<asp:Label ID="Label15" runat="server" Text="Comune"></asp:Label></td>
<td align="left" colspan="2" style="height: 15px">
<asp:DropDownList ID="DropDownList4" runat="server" AutoPostBack="True" DataSourceID="ComuneScaricoDataSource"
DataTextField="Comune" DataValueField="IDComune">
<asp:ListItem Selected="True">Selezionare una provincia</asp:ListItem>
</asp:DropDownList>
<asp:ObjectDataSource ID="ComuneScaricoDataSource" runat="server" OldValuesParameterFormatString="original_{0}"
SelectMethod="GetData" TypeName="DataSet1TableAdapters.ComuneTableAdapter">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList3" Name="IDProvincia" PropertyName="SelectedValue"
Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
</td>
</tr>
<tr>
<td align="right" style="width: 200px; height: 15px">
<asp:Label ID="Label18" runat="server" Text="C.A.P."></asp:Label></td>
<td align="left" colspan="2" style="height: 15px">
<asp:TextBox ID="TXCapScarico" runat="server" Width="80px"></asp:TextBox></td>
</tr>
<tr>
<td align="right" style="width: 200px; height: 15px">
</td>
<td align="left" colspan="2" style="height: 15px">
</td>
</tr>
<tr>
<td align="right" style="width: 200px; height: 15px">
<asp:Label ID="Label16" runat="server" Text="Telefono"></asp:Label></td>
<td align="left" colspan="2" style="height: 15px">
<asp:TextBox ID="TXTelefonoScarico" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td align="right" style="width: 200px; height: 15px">
</td>
<td align="left" colspan="2" style="height: 15px">
</td>
</tr>
<tr>
<td align="right" style="width: 200px; height: 15px">
<asp:Label ID="Label17" runat="server" Text="Fax"></asp:Label></td>
<td align="left" colspan="2" style="height: 15px">
<asp:TextBox ID="TXFaxScarico" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td align="right" style="width: 200px; height: 15px">
</td>
<td align="left" colspan="2" style="height: 15px">
</td>
</tr>
<tr>
<td align="right" style="width: 200px; height: 15px">
<asp:Label ID="LabelCodiceCliente" runat="server" Text="Codice cliente" Visible="False"></asp:Label></td>
<td align="left" colspan="2" style="height: 15px">
<asp:TextBox ID="TXCodiceCliente" runat="server" Visible="False"></asp:TextBox></td>
</tr>
<tr>
<td align="left" colspan="3" style="height: 15px">
</td>
</tr>
<tr>
<td style="width: 200px; height: 15px" align="right">
</td>
<td style="width: 200px; height: 15px">
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" OnClientClick="StartInsert();"
Text="Inserisci cliente" /></td>
<td style="width: 200px; height: 15px">
</td>
</tr>
</table>
</ContentTemplate>
</atlas:UpdatePanel>

<atlas:UpdateProgress ID="updateProgress1" runat="server">
<ProgressTemplate>
<table style="position: absolute; top: 100px; left: 50%; margin: 0px -100px; z-index: 4;
border-right: appworkspace thin solid; border-top: appworkspace thin solid; border-left: appworkspace thin solid;
border-bottom: appworkspace thin solid; background-color: inactivecaptiontext;
width: 200px;">
<tr>
<td style="font-family: Verdana; font-weight: bold; font-size: 10px; color: maroon;">
<img alt="" src="http://pics.10026.com/?src=images/spinner.gif" />
Contacting Server...
<button id="abortButton">
Stop</button>
</td>
</tr>
</table>
</ProgressTemplate>
</atlas:UpdateProgress>
</td>
</tr>
</table>
</asp:Content>


hiya,

I think using the Atlas UpdateProgress thing "which comes with Jan release" would help. Try to use it

Thanks,


I am using Jenuary release.

if I see the page with IE7 that is very nice, no refresh but with ie6 is very bad.


What's the purpose of the following line from your code? Doesn't this force 3 seconds of pause that you've mentioned?

System.Threading.Thread.Sleep(3000)

Ciao,

I use the System.Threading.Thread.Sleep(3000) just to simulate the insert into database.

No comments:

Post a Comment