Showing posts with label refresh. Show all posts
Showing posts with label refresh. Show all posts

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.

Wednesday, March 21, 2012

Dropdownlist doesnt refresh in Updatepanel

Hi all,

I'm just taking my first steps in the altlas world here, so i guess the problem below will be due to myself:

i created an .aspx page containing some dropdowns, and coded the functionality using postbacks. Up until there it all works. Then i tried to refresh one of the dropdowns using Atlas - triggered by another dropdown control.

Now when i change the selected value in the "trigger" control, the code filling the other dropdown is executed but the controls content isn't refreshed when the execution is completed.

Here's the code on the aspx page...

...

<atlas:ScriptManager ID="s" EnablePartialRendering="true" runat="server"></atlas:ScriptManager>

...

SalesCompany:<asp:DropDownList ID="ddlSalesCompany" runat="server" OnSelectedIndexChanged="ddlSalesCompany_SelectedIndexChanged" AutoPostBack="true"></asp:DropDownList><br/>
Series:<asp:DropDownList ID="ddlSeries" runat="server" OnSelectedIndexChanged="ddlSeries_SelectedIndexChanged" AutoPostBack="true"></asp:DropDownList><br/>
<atlas:UpdatePanel ID="up1" runat="server">
<ContentTemplate>
Model:<asp:DropDownList ID="ddlModel" runat="server" OnSelectedIndexChanged="ddlModel_SelectedIndexChanged" AutoPostBack="true"></asp:DropDownList><br/>
</ContentTemplate>
<Triggers>
<atlas:ControlValueTrigger ControlID="ddlSeries" PropertyName="SelectedIndex" />
</Triggers>
</atlas:UpdatePanel>

in my "code behind" page i have:

protected void ddlSeries_SelectedIndexChanged(object sender, EventArgs e)
{
FillModels();
}

private void FillModels()
{
if (ddlSeries.SelectedValue != "0")
{
Proxy.Pricing.Model.ModelService ModelSVC = new Proxy.Pricing.Model.ModelService();
DKSerie dkSerie = new DKSerie(ddlSeries.SelectedValue.ToString());

List<Model> myModels = ModelSVC.GetModels(dkSerie, null);

ddlModel.DataSource = myModels;
ddlModel.DataTextField = "Name";
ddlModel.DataValueField = "OID";
ddlModel.DataBind();

ddlModel.Items.Insert(0, new ListItem("Select a model", "0"));
}
else
{
ddlModel.Items.Clear();
ddlModel.Items.Insert(0, new ListItem("Select a series", "0"));
}
}

Can somebody help me on this one?

Thanks in advance,

Wesley Van den Eede

The thing that triggers the UpdatePanel is the Triggers Collection of the Update Panel. I noticed in your Triggers Collection you have the property of the trigger to be "SelectedIndex" where it probably should be "SelectedIndexChanged" (at least it is in mine).

Mike


Hi Mike,

Thanks for the reply, but...

Isn't that in case i use a ControlEventTrigger instead of a ControlValueTrigger?

I watched Scott's presentation athttp://atlas.asp.net/ and he uses SelectedIndex.

Wesley


Sorry for the double post...

The thing is that, i don't think it is related to the trigger... because when i debug and put a breakpoint on the FillModels() function, the debugger really steps in. It looks like the actual rendering of the control isn't refreshed?

Wesley


Can you monitor the network traffic using Fiddler or Nikhil's browser helper and tell us what you see?

Hi,

Sorry for the late reply (working on another project :))

Today i tried to use fiddler a bit, but then i found out that it doesn't work with IE7?, I'll try to send the fiddler output this afternoon anyway.

On the other hand i did some more investigation and found out that it is probably related to two other controls i use further in the page: Infragistics.WebUI.WebDateChooser.v1.2

When i remove the controls it all works, so i guess it's now a case of making them work together (or replacing the WebDateChooser controls) ... any suggestions?

Kind regards,

Wesley Van den Eede


Yes, we know of a few problems with the Infragistics controls which are quite heavily using JavaScript.

I just updated our datepicker controls to the latest trial version of the netadvantage suite (2006 Vol. 1) ... now it works perfectly...

Thanks for the responses.

DropDownExtender: Refresh content

I have a drop-down extender, where the control ID references a Panel, which contains a TreeView. When I update the contents of the TreeView, and hit the drop-down button, the treeview shown is not refreshed. Is there any way that I can force a refresh?

Thanks - Bennie

How are you updating the treeview?

Ron


I am adding/removing tree nodes in a public method of the treeview.


Is the TreeView in an UpdatePanel? I'm trying to determine how all of the controls in question are composed. Could you post a snippit of the aspx?


this is the DropDownExtender:

<

ajaxToolkit:DropDownExtenderrunat="server"ID="DDE"TargetControlID="bookmarksTextLabel"DropDownControlID="DropPanel"/>

This is the DropPanel:

<asp:PanelEnableViewState="false"ID="DropPanel"ForeColor="#747678"runat="server"Style="text-align:left;padding-bottom:0px;padding-top:0px;margin-bottom:0px;margin-top:0px;display:none;visibility:hidden;">

<divstyle="border-color:Blue; border-width: 1px; border-style:solid; padding: 1px,1px,1px,1px;">

<bmt:BookmarksTreeid="tvBookmarks"runat="server"/></div></asp:Panel>

I tried enabling/disabling ViewState, but to no avail.


Does it work without using the drop-down extender? Please verify that the tree is populating correctly without the extender on the page. Is all of this content within an UpdatePanel?

It does work without the DropDownExtenter. No, there is no outer UpdatePanel.