Working with multiple update panels and timer dedicated to specific updatepanel - c#

I have the code on master page as follows:
<asp:Timer ID="Timer1" runat="server" Interval="10000" ontick="Timer1_Tick"></asp:Timer>
<asp:UpdatePanel ID="updateNotifications" runat="server" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
</Triggers>
<ContentTemplate>
//Content
</ContentTemplate>
</asp:UpdatePanel>
This is working fine and refreshes the content with defined interval, but it also updates all the update panels on the content pages. I have to refresh only the content inside this update panel. I have tried UpdateMode="Conditional" and UpdateMode="Always" too but to no help.

Related

FileUpload.hasFile returning false inside update panel

I have been through several links but didn't find anything helpful. I know it has been asked several times here.
Here is my frontend code
<asp:UpdatePanel runat="server" ID="UpdatePanel1" UpdateMode="Conditional">
<ContentTemplate>
<asp:FileUpload runat="server" ID="fuItemImage" Width="370px" TabIndex="12" />
</ContentTemplate>
<Triggers>
</Triggers>
</asp:UpdatePanel>
Here is the backend code
if (fuItemImage.HasFile)
{
MyFunction.UploadThisFile(anything)
}
When I upload any image and click on the save button it shows false in FileUpload.HasFile. I am stuck and finding no solution for it.
Any help would be appreciated.
you can try this
<asp:ScriptManager runat="server"></asp:ScriptManager>
<asp:UpdatePanel runat="server" ID="UpdatePanel1" UpdateMode="Conditional">
<ContentTemplate>
<asp:FileUpload runat="server" ID="fuItemImage" Width="370px" TabIndex="12" />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID = "Button1" />
</Triggers>
</asp:UpdatePanel>
add the button id in triggers to upload the file which will do postback

How to active AsyncPostBackTrigger in Update Panel?

I created a updatePanel, is include some dropdownlist and a few button and I use AsyncPostBackTrigger for not update all page when the click button or select dropdownlist.
My page structure that an aspx page and also use user control page. I use updatePanel on UserControlPage.
Here is My code and I wish you help me:
<asp:UpdatePanel ID="UpdMonthly" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:DropDownList ID="ddlSenetIslemleriAlinanUrun1" AutoPostBack="true" OnSelectedIndexChanged="ddlSenetIslemleriAlinanUrun1_SelectedIndexChanged" runat="server"></asp:DropDownList>
<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
<asp:Button ID="btnKaydet" style="margin:10px ;" Width="100" Height="50" runat="server" Text="Kaydet" OnClick="btnKaydet_Click"/>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ddlSenetIslemleriAlinanUrun1" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="btnKaydet" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
I have some knowledge on placeholder but when the click dropdown or button, page is postback and placeholder knowledge dissappear.
how to fix postback problem?
Thanks for your answers.

asp.net update panel runs java script calls

I have this update pannel
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Timer ID="Timer1" runat="server" OnTick="Timer1_Tick">
</asp:Timer>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
</Triggers>
</asp:UpdatePanel>
This update panel updates each 2 minutes.
I have a javascript functions that fills the data into a canvas, I wan this javascript function to be fired each time this update panel updates.
how to do that please?
where should I put the script? maybe inside the update panel
thanks in advance
I believe you will find the solution in this thread: How to have a javascript callback executed after an update panel postback?
put it inside
function pageLoad(sender, args) {
... }

asyncfileupload inside update panel not triggering the upload method

I am having a asyncfileupload inside a update panel, I want to upload the file once when a file is selected , the same code works well outside the update panel but my design is in such a way that I can put this outside the update panel, how can I make this work
<asp:UpdatePanel ID="UP_DDL" runat="server" UpdateMode="Always" Visible="true"
RenderMode="Inline">
<ContentTemplate>
<asp:asyncfileupload id="AFU_Doc" runat="server"
uploadingbackcolor="Yellow" onuploadedcomplete="btnDocUpload_Click"
onclientuploadcomplete="sa" throbberid="spanUploading2" />
<span id="spanUploading2" runat="server">Uploading...</span>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="AFU_Doc" />
</Triggers>
</asp:UpdatePanel>

AsyncPostBackTrigger is not a known element?

I'm using asp.net and c#, making a page with ajax updatepanels. When I try and insert the trigger element, I get the error message AsyncPostBackTrigger is not a known element. What am I missing?
<asp:UpdatePanel ID="UdpEPL" runat="server" UpdateMode="Conditional"
Visible="False">
<ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="BtnEplShowSubmit"
EventName="BtnEplShowSubmit_Click"/>
</Triggers>
</ContentTemplate>
</asp:UpdatePanel>
Remove the Triggers section from your ContentTemplate:
<asp:UpdatePanel ...>
<Triggers>
<asp:AsyncPostBackTrigger .../>
</Triggers>
<ContentTemplate>
</ContentTemplate>
</asp:UpdatePanel>

Categories