I'm looking to update the contents of a panel using an asp:updatepanel.
I get an error on the page saying: DotNetNuke.Services.Exceptions.ModuleLoadException: Type 'System.Web.UI.UpdatePanel' does not have a public property named 'TextBox'.
See code below:
<asp:ScriptManager runat="server" ID="ScriptManager" />
<asp:UpdatePanel runat="server" ID="brandAddingContainer" Visible="false">
<ContentTemplate>
<asp:LinkButton runat="server" ID="brandAddingPrompt">
<img src="/images/add.gif" alt="Add New Brand" onclick="addNewBrand_clicked"/> Add New Brand
</asp:LinkButton>
<asp:Panel ID="sendNewBrand" runat="server">
<asp:TextBox runat="server" ID="newBrandName"></asp:TextBox>
<asp:Button runat="server" ID="sendBrandName" Text="Add Brand" OnClick="sendNewBrand_clicked" />
<asp:Label runat="server" ID="insertionFeedback" Visible="false" />
</asp:Panel>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="brandAddingPrompt" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
Using ScriptManager in module controls is not advisable, I would suggest to remove ScriptManager from your module code and use Enable Prtial Rendering checkbox in module control definition.
What version of .net framework and dnn are you using? try installing ajax extensions installed?
there is also a an entire section in adef web server site here that can be helpful.
Related
My project is a Asp.Net project. The code is written in vb.net.
There are file-upload and a gridview with this TemplatesField:
<asp:TemplateField HeaderText="Edit">
<ItemTemplate>
<a onserverclick="fnEditWork" class="AEditWork" href='<%#Eval("WorkID")' runat="server" id="EditWork"></a>
</ItemTemplate>
<ItemStyle Width="30px" />
</asp:TemplateField>
in this situation the file-upload works but the anchor does not fire post-back. (the 'fnEditWork' function on onserverclick does not fire.) But when I comment the file-upload code out then fnEditWork function fires.
How can I make it work?
You can do it with AJAX.
Put something like that arround it
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
</ContentTemplate>
<Triggers>
<asp:AsyncPostbackTrigger ControlID="AEditWork" EventName="onserverclick" />
</Triggers>
</asp:UpdatePanel>
I have an obout ColorPickerExtender in an UpdatePanel along with some other controls. The other controls execute partial postbacks as expected, but the ColorPickerExtender executes a full postback despite being in the UpdatePanel. Here's the relevant ASPX:
<asp:Content ContentPlaceHolderID="cphMainDivContentPlaceHolder" runat="server">
<asp:UpdatePanel ID="upGeneralLayoutData" runat="server">
<ContentTemplate>
<asp:TextBox ID="txtLayoutName" runat="server"
ToolTip="Enter a name for this layout (recommend you use a unique name)"
OnTextChanged="txtLayoutName_TextChanged"
AutoPostBack="true"
MaxLength="255" />
<obout:ColorPickerExtender ID="cpeLayoutBackgroundColor" runat="server"
OnClientOpen="onColorPickerExtenderOpen"
AutoPostBack="true"
TargetProperty="style.backgroundColor"
OnColorPostBack="cpeLayoutBackgroundColor_ColorPostBack"
PopupButtonID="txtLayoutBackgroundColor"
TargetControlID="txtLayoutBackgroundColor"
HexView="False"
PickButton="False" />
<asp:TextBox ID="txtLayoutBackgroundColor" runat="server"
ToolTip="Select the background color for this layout"
CssClass="ColorPickerExtenderTextBox"
style="cursor: pointer"
Width="50"
ReadOnly="True" />
<br />
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
As I was formulating the question, I was able to figure out the answer (see below)--instead of trashing the question, I left it here for others to use.
It turns out that the ColorPickerExtender is not being registered as an async postback control. I got the clue from this post. I'm not sure why it doesn't register as an async control when the others do, but the fix is easy enough--add a <Triggers> section that explicitly designates it as async, like so:
<Triggers>
<asp:AsyncPostBackTrigger ControlID="cpeLayoutBackgroundColor" EventName="ColorPostBack" />
</Triggers>
<%# Control Language="C#" AutoEventWireup="true" CodeBehind="ChatUserControl.ascx.cs"
Inherits="MetamorphismApp.ChatUserControl" %>
<asp:Timer ID="timer1" runat="server" OnTick="timer1_Tick" Interval="5000">
</asp:Timer>
<div id="divChatWindow" class="clChatWindow">
<div>
<asp:Label runat="server" Text='<%# Eval("username") %>' class="divHeader" ID="lblChatFriend"></asp:Label>
<asp:Image ID="imgFriend" runat="server" CssClass="classFriendImage" />
<asp:LinkButton ID="lbClose" runat="server" CommandName="Close" CssClass="lbClose"
OnClick="lbClose_Click">Close</asp:LinkButton></div>
<div class="chatText" id="idChatText" runat="server">
<asp:UpdatePanel ID="UpdatePanel" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="timer1" EventName="Tick" />
<asp:AsyncPostBackTrigger ControlID="btnSendChat" EventName="Click" />
</Triggers>
<ContentTemplate>
<asp:Repeater runat="server" ID="rpChatMessages">
<ItemTemplate>
<asp:Image ID="imageForFriend" runat="server" CssClass="clFriendsImage" ImageUrl='<%# "HttpImageHandler.jpg?username=" + DataBinder.Eval(Container.DataItem,"fromusername").ToString() %>' />
<asp:Label ID="chatMessage" runat="server" Text='<%# Eval("Message") %>'></asp:Label>
<br>
</ItemTemplate>
</asp:Repeater>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<asp:TextBox ID="txtChatMessage" runat="server" Width="142px" CssClass="clChatMessage" EnableViewState="true"
TextMode="MultiLine"></asp:TextBox>
<asp:LinkButton ID="btnSendChat" runat="server" CommandName="Insert" CommandArgument='<%# Eval("username") %>'
OnClick="btnSendChat_Click" CssClass="btnSendChat">Send</asp:LinkButton>
</div>
I want to use updatepanel triggered by a timer control and after 5 seconds I get a sys.webforms error. I dont wanna populate my repeater using a webservice to be called via jquery and binding the data to the repeater. I want to use the updatepanel for data population. I have read several articles to avoid this error but havent found a solution yet. If I change asyncpostback trigger to postbacktrigger the page does a postback which I dont want to happen. I want to use updatepanel to solve this issue. What should I do?
It looks like you forgot to put ScriptManager control on your page.
I am getting error 503 status code. To my surprise if you are facing this error issue on the server then this issue is a server's issue and not your coding issue. Status 503 indicates that the server cannot fulfill the request and it gives this error. Try contacting your hosting provider.
I want to trigger my updatepanel change when I click on a HyperLink But I get an error saying:
Control with ID 'X' being registered through RegisterAsyncPostBackControl or RegisterPostBackControl must implement either INamingContainer, IPostBackDataHandler, or IPostBackEventHandler.
If I use ASP Button, then everything works correctly
My code:
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel runat="server" id="UpdatePanel" updatemode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger controlid="UpdateButton2" eventname="Click" />
</Triggers>
<ContentTemplate>
<asp:Repeater ID="rptDossiers" runat="server">
<ItemTemplate>
...
</ItemTemplate>
</asp:Repeater>
<asp:HyperLink NavigateUrl="#" runat="server" id="UpdateButton2" onclick="tousLesDossiers_Click">
Tous les Dossiers
</asp:HyperLink>
<%--<asp:Button runat="server" id="UpdateButton2" onclick="tousLesDossiers_Click" text="Update" />--%>
</ContentTemplate>
</asp:UpdatePanel>
Any suggestions?
Thanks
There is no Click event handler that is tied to the Hyperlink control, you have to use LinkButton Instead
Im trying tp upload more than one image, and when each one I upload I will show it in a repeater, but in the code behind the FileUpload1.HasFile is always False , this is a piece of my code :
<asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="true" UpdateMode="Conditional" >
<ContentTemplate>
<asp:Repeater ID="rpUploadedImages" runat="server">
<ItemTemplate>
<img src='../Images/<%# DataBinder.Eval(Container.DataItem, "ImagePath")%>'/><br />
</ItemTemplate>
</asp:Repeater>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnupload" EventName="click" />
</Triggers>
</asp:UpdatePanel>
<asp:FileUpload ID="FileUpload1" runat="server" /><br />
<asp:Button ID="btnupload" runat="server" Text="Upload" onclick="btnupload_Click" />
The FileUpload control does not work with UpdatePanel, you will need to do a full post back to get the file on the server... Now there are a lot of tricks to make it ajaxy...
http://geekswithblogs.net/ranganh/archive/2008/04/01/file-upload-in-updatepanel-asp.net-ajax.aspx
Another tricky way is to create iframe with fileupload + submit button(or some trigger) inside your main form. iframe will postback with no effect to main page.