AjaxFileUpload has randomly stopped firing OnUploadComplete event - c#

My AjaxFileUpload control has randomly stopped working in the last few weeks.
I am getting this chrome console error - "Uncaught TypeError: Cannot read property 'cannotDeserializeInvalidJson' of undefined" - whenever I click the control's upload button. I'm not sure if this error is to do with the control not working, but the control's OnUploadCompled method is not being called.
Am totally pulling my hair out over this, cannot figure out what is going wrong as I have not made any significant changes between it working and not.
Any help would obviously be greatly appreciated!
Relevant code:
<asp:UpdatePanel runat="server" style="display: inline-block; padding-right: 20px;">
<ContentTemplate>
<asp:Label ID="lblMessage" runat="server" Text="" Font-Names = "Arial"></asp:Label>
<asp:Image ID="imgAsset" runat="server" />
<asp:HiddenField ID="hdnURl" runat="server" />
<asp:Button ID="btnShowimages" text="Show Images" CssClass="gallery-link" OnClientClick="showGallery(); return false;" runat="server" Style="position: center; bottom: 5px;" />
<cc1:AjaxFileUpload ID="ajaxUpload" runat="server" OnClientUploadStart="clientUpload()" OnUploadComplete="ajaxUpload_UploadComplete" Width="280px" style="min-width:200px; visibility:hidden; display:none;" MaximumNumberOfFiles="5" />
<asp:Button ID="btnShowUpload" OnClientClick="showUploader();return false;" runat="server" Text="Add images" CssClass="btn btn-success" Style="position: center; bottom: 5px;" />
<asp:Button ID="btnSave" OnClick="saveMaintenanceForm" runat="server" Text="Save" CssClass="btn btn-success" Style="position: center; bottom: 5px;" />
<label></label>
<asp:Button ID="btnCancelFault" OnClick="btnCancel_Click1" runat="server" Text="Cancel" CssClass="btn btn-danger" Style="position: center; bottom: 5px;" CausesValidation="false" />
</ContentTemplate>
</asp:UpdatePanel>

Related

Update panel refreshing the entire page instead of just partial

I did what i normally do whenever i want a partial refresh of a page, but in this case it doesnt work out. There maybe an excessive usage of update panels but it should still work.... Can anyone tell me why?
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div style="width: 15%; float: left;">
<asp:Image ID="Image1" runat="server" ImageUrl="~/Img/Untitled1.png" CssClass="imagez" />
</div>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<div style="width: 85%; float: left; height: 100%; padding-top: 2%;">
<asp:Label ID="Label2" runat="server" Text="CPU" CssClass="auto-style7" Font-Names="sans-serif"></asp:Label>
<br />
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" CssClass="bla" Font-Names="sans-serif" AppendDataBoundItems="true" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
<asp:ListItem Selected="True">Pick a CPU</asp:ListItem>
<asp:ListItem Text="a" Value="a"></asp:ListItem>
</asp:DropDownList>
<strong>
<asp:Label ID="Label3" runat="server" Text="$" CssClass="auto-style8" Font-Names="sans-serif"></asp:Label>
<asp:Label ID="Label4" runat="server" Text="0.00" CssClass="auto-style8" Font-Names="sans-serif"></asp:Label>
</strong>
</div>
</ContentTemplate>
</asp:UpdatePanel>

10% margin on popup

how can i make this modal popup fill 80% of the screen in the x and y direction. i.e a margin of 10% on each side
Markup
<!-- Add Files Modal Form -->
<asp:HiddenField ID="AddFilesForModal" runat="server" />
<ajaxToolkit:ModalPopupExtender runat="server" ID="AddFilesModal" BehaviorID="modalPopupExtenderAddFiles"
TargetControlID="dummyButtonAddToPendingList" PopupDragHandleControlID="PanelAddFilesOuter" PopupControlID="PanelAddFilesOuter"
OkControlID="dummyButtonAddToPendingList" BackgroundCssClass="ModalTreeviewBackgroundz" DropShadow="false"
Drag="true">
</ajaxToolkit:ModalPopupExtender>
<ajaxToolkit:RoundedCornersExtender ID="RoundedCornersExtender4" runat="server" TargetControlID="PanelAddFilesInner">
</ajaxToolkit:RoundedCornersExtender>
<asp:Panel ID="PanelAddFilesOuter" runat="server" BackColor="Transparent" Style="display: none;">
<asp:Panel ID="PanelAddFilesInner" runat="server" BackColor="White" >
<ContentTemplate>
<div id="AddFilesContainer">
<br />
<div style="max-height:800px;overflow:auto;">
<asp:TreeView ID="TreeViewAddItems" runat="server" BorderStyle="Solid" ShowCheckBoxes="Leaf"
Width="99%" ImageSet="XPFileExplorer" NodeIndent="15" PathSeparator="\" ShowExpandCollapse="true"
EnableClientScript="true" OnTreeNodeCheckChanged="OnTreeNodeCheckChanged" OnAdaptedTreeNodeCheckChanged="OnTreeNodeCheckChanged" ShowLines="True">
<HoverNodeStyle Font-Underline="True" ForeColor="#6666AA" />
<NodeStyle Font-Names="Tahoma" Font-Size="8pt" ForeColor="Black" HorizontalPadding="2px"
NodeSpacing="0px" VerticalPadding="2px" />
<ParentNodeStyle Font-Bold="False" />
<SelectedNodeStyle BackColor="#B5B5B5" Font-Underline="False" HorizontalPadding="0px"
VerticalPadding="0px" />
</asp:TreeView>
</div>
<br />
<div class="base">
<asp:LinkButton ID="lnkAddToPendingList" runat="server" OnClick="BtnAddToPendingList_Click" BorderStyle="Solid" BackColor="#CCCCCC">Add selected items to list</asp:LinkButton>
<asp:Button CssClass="Button" ID="dummyButtonAddToPendingList" runat="server" Style="display: none;" />
<asp:Button CssClass="Button" ID="CancelAddFiles" runat="server" Text="Cancel" OnClientClick="$find('modalPopupExtenderAddFiles').hide(); return false;" />
</div>
</div>
</ContentTemplate>
</asp:Panel>
</asp:Panel>
<!-- End Add Files Modal Form -->
Look at the resulting HTML, and style it with CSS. The CSS likely will look something like this:
.modal {
display: block;
width: 90%;
height: 90%;
margin: auto;
}

JavaScript not loading after partial update in ASP.Net

I have a problem with Javascript not load in asp.net when an updatepanel postback to the server and the problem is that javascript code is not in the same page where the updatepanel is so I can put it in pageLoad() function it is like this:
<script src="js/keyboard.js" type="text/javascript"></script>
and i use ASP.Net 4 and c# and this is my code code:
<link href="css/keyboard.css" rel="stylesheet" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div style="text-align: left; padding-right: 140px">
<dx:aspxcombobox id="comboBoxLangauge" clientinstancename="comboboxLang"
cssclass="combo" runat="server" width="140px" clientidmode="Static">
<Items>
<dx:ListEditItem Text="English to Kurdish" Value="1" Selected="true" />
<dx:ListEditItem Text="Kurdish to English" Value="2" />
</Items>
<ClientSideEvents SelectedIndexChanged="IndexChanged" />
</dx:aspxcombobox>
</div>
<br />
<br />
<asp:Button ID="btnTranslate" runat="server" Text="Search" ClientIDMode="Static"
CssClass="Search" OnClick="btnTranslate_Click" />
<asp:TextBox ID="txtBoxWord" runat="server" ClientIDMode="Static"
class="keyboardInput Search" Style="width: 260px; direction: ltr"></asp:TextBox>
<asp:AutoCompleteExtender ID="autocom" ClientIDMode="Static" runat="server" CompletionSetCount="10"
EnableCaching="true" MinimumPrefixLength="1" TargetControlID="txtBoxWord" ServicePath="~/translator/AutoComplete.asmx" ServiceMethod="GetCompletionList">
</asp:AutoCompleteExtender>
<asp:RoundedCornersExtender ID="RoundedCornersExtender1" runat="server" TargetControlID="OutPanel"
Corners="All" Radius="5" BorderColor="Silver">
</asp:RoundedCornersExtender>
<br />
<br />
<div id="OutPanel" runat="server" clientidmode="Static" style="width: 440px; height: 200px; overflow: auto; margin-left: auto; margin-right: auto; padding-top: 10px;" visible="false">
</div>
</ContentTemplate>
</asp:UpdatePanel>
<div id="OutPanel" runat="server" clientidmode="Static" style="width:440px;height:200px;overflow:auto;margin-left:auto;margin-right:auto;padding-top:10px;" visible="false">
</div>
</ContentTemplate>
</asp:UpdatePanel>
"The problem is that javascript code is not in the same page where the updatepanel is"
Whereas make sure your JavaScript is available on the page with UpdatePanel to load it properly.

How to format the RadComboBox properly

I am trying to make an arrow show to the left of the text, but I cant figure out how to format it to make it work.
And my mark up for the rad box is as follows:
<telerik:RadComboBox ID="optionsp" runat="server" HighlightTemplatedItem="true">
<ItemTemplate>
<img src="../../../Themes/Images/icons/myimage.gif" />
<div style="text-align: left; padding-left: 5px">
<asp:Label runat="server" ID="Label1" Text='<%# Eval("Name") %>' >
</asp:Label>
</div>
</ItemTemplate>
</telerik:RadComboBox>
Try with this (added float: left for img and div.
<telerik:RadComboBox ID="optionsp" runat="server" HighlightTemplatedItem="true">
<ItemTemplate>
<img src="../../../Themes/Images/icons/arrow2.gif" style="float: left" />
<div style="text-align: left; padding-left: 5px; float: left">
<asp:Label runat="server" ID="Label1" Text='<%# Eval("Name") %>' >
</asp:Label>
</div>
</ItemTemplate>
</telerik:RadComboBox>
As a side note, avoid inline style definitions as much as possible, you should move them to a css file.

ModalPopup click twice when IFrame XPAD is on the page

I have a aspx page, with a modalpopup extender, and it's work perfect.
But I place an Iframe on the end of the page, and the modelpopup work only when I click the button twice. I can't find the answer for this problem.
<asp:UpdatePanel ID="UpdatePanel4" runat="server">
<ContentTemplate>
<div class="szamlabal14">
Csatlakozási pont:
<input type="hidden" id="hdnCsatlakozasiPontKod" runat="server" value="0" />
<asp:TextBox ID="txtCsatlakozasiPont" runat="server" Width="480" onkeydown="return false;"></asp:TextBox>
<asp:Button ID="btnCsatlakozasiPont" runat="server" Text="..." />
<cc1:ModalPopupExtender ID="mpeCsatlakozasiPont" runat="server" CancelControlID="btnCancel"
TargetControlID="btnCsatlakozasiPont" OkControlID="btnOk" PopupControlID="pnPopup"
PopupDragHandleControlID="PopupHeader" Drag="true" BackgroundCssClass="modalBackground">
</cc1:ModalPopupExtender>
<asp:Panel ID="pnPopup" Style="display: none" runat="server">
<div class="modalPopup">
<div style="position: relative; left: 670; margin: 3px;">
<asp:Button ID="btnCancel" runat="server" Text="x" CausesValidation="false" OnClientClick="return false;" />
<asp:Button ID="btnOk" runat="server" Text="Ok" Style="display: none" CausesValidation="false"
OnClientClick="return false;" />
</div>
<iframe id="ifrCsatlakozasiPont" height="350px" width="700px" src="CsatlakozasiPont.aspx"
frameborder="1"></iframe>
</div>
</asp:Panel>
</div>
</ContentTemplate>
</asp:UpdatePanel>
When I delete the following part, the modalpopup work well again.
<div style="margin-top: 10px; z-index: 10; border: 1px solid black; position: absolute;
top: 130px;">
<iframe src="http://ismts38105/viewer/ImageViewer.xbap?<%=Image%> width="1440"
height="400" />
</div>
You need to set the permissions on your Internet Explorer. XBAP requires you add the domain/IP to the trusted sites, or else you will be unable to do anything with them.

Categories

Resources