PDA

View Full Version : Ext+ASP.NET+ Ajax



roman.buzuk
10 Apr 2013, 12:29 AM
I have some problem with using Ext 4.1.1 in ASP.NET project.
This is part of my code:

var dialog = new Ext.Window({
contentEl: document.getElementById('<%= dlgSaveAs.ClientID %>'),
collapsible: false,
width: 205,
height: 120,
shadow: true,
title: '<%=Resources.Resource.SaveAs %>',
draggable: true,
resizable: false,
modal:true,
layout:'fit',
multiline: false
}) ;



<div id="dlgSaveAs" runat="server" style="display:none"> <div class="x-dlg-bd">
<asp:TextBox ID="tboxSaveAsName" runat="server"></asp:TextBox>
<ajaxToolkit:FilteredTextBoxExtender ID="" TargetControlID="tboxSaveAsName"
runat="server" InvalidChars="'&quot;""" FilterMode="InvalidChars" />
<br />
<asp:Label ID="lblSaveAsError" runat="server"></asp:Label>
</div>
</div>
Problem is with asynchrone callback
First time it works fine, but than I get " Error: Sys.InvalidOperationException: Two components with the same id 'ctl00_cphMainContainer_FilterContainer_dlgSaveAs_fltboxSaveAsName' can't be added to the application.
How i can eliminate error?

tvanzoelen
10 Apr 2013, 2:50 AM
Is it a server side error? Are you sending ajax calls to an aspx page?

Could imagine that you then get errors. You should post Ajax calls to anoher page or handler to process them. Else the serverpage is recreating the servercomponents at every call.

roman.buzuk
10 Apr 2013, 11:13 PM
This project was on Ext 1.1 and there are not errors. When I tried to remake it on Ext 4.1, problem appears.
All, that I change is:


//EXT 1.1
show: function () { if (!dialog || asyncPostBack) {
dialog = new Ext.BasicDialog('<%= dlgSaveAs.ClientID %>', {
collapsible: false,
width: 205,
height: 120,
shadow: true,
resizable: false,
draggable: true,
proxyDrag: true,
modal: true
});
dialog.addKeyListener(27, dialog.hide, dialog);
dialog.addButton('<%= Resources.Resource.Save %>', onSave, dialog);
dialog.on('show', onShow);
dialog.on('hide', onHide);
asyncPostBack = false;
}
document.getElementById('<%= tboxSaveAsName.ClientID %>').value = "";
document.getElementById('<%= lblSaveAsError.ClientID %>').innerHTML = "";
dialog.show();
}
on this:

var dialog = new Ext.Window({ contentEl: document.getElementById('<%= dlgSaveAs.ClientID %>'),
collapsible: false,
width: 205,
height: 120,
shadow: true,
title: '<%=Resources.Resource.SaveAs %>',
draggable: true,
resizable: false,
modal:true,
layout:'fit',
multiline: false,
buttons: [
{
text: '<%= Resources.Resource.Save %>',
handler: onSave
}]
}) ;

tvanzoelen
10 Apr 2013, 11:35 PM
Is it a serverside error or a clientside error? Where the error is thrown?