Timer refreshing all updatepanels to refresh - c#

I have a single timer in my html and 3 updatepanels, i want to refresh a specific updatepanel and not the 2 others. However the timer is causing all updatepanels to refresh for some reason. This is my updatepanel code that i want to refresh:
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:Timer runat="server" id="UpdateTimer" interval="2000" ontick="function" />
<asp:UpdatePanel ID="UpdatePanelMain" runat="server" updatemode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger controlid="UpdateTimer" eventname="Tick" />
</Triggers>
<ContentTemplate>
And the other updatepanels look like this without the triggers:
<asp:UpdatePanel ID="UpdatePanelDiag" runat="server">
<asp:UpdatePanel ID="UpdatePanelUi" runat="server">
However they are still updated, any idea why?

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

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) {
... }

How to prevent content page from being updated when the master page is updated?

I've an UpdatePanel in the master page and another one in the content page. When I use Timer to refresh the master page, the content page, which has its own Timer, is updated, too.
Question 1: How can I prevent the refresh in the master page from updating the content page?
Question 2: The Timer interval in the content page, is set at 60000. When the page is loaded, I've to wait 60000 to see the GridView data displayed. How to make it display data as soon aas the page is loaded and then refresh the data every 60000?
Site.Master:
<asp:ScriptManager ID="ScriptManagerMouseRegion" runat="server"></asp:ScriptManager>
<asp:Timer runat="server" id="SiteMasterTimer" Interval="10000" OnTick="SiteMasterTimer_Tick"></asp:Timer>
<asp:UpdatePanel ID="UpdatePanelMouseRegion" runat="server">
<ContentTemplate>
// mouse region to be updated
Default.aspx:
<asp:ScriptManagerProxy ID="DisplayResultsScriptManager" runat="server">
</asp:ScriptManagerProxy>
<asp:Timer ID="DisplayResultsTimer" Interval="60000" Enabled="true" runat="server" OnTick="DisplayResultsTimer_Tick">
</asp:Timer>
<asp:UpdatePanel ID="DisplayResultsUpdatePanel" runat="server" >
<Triggers>
<asp:AsyncPostBackTrigger ControlID="DisplayResultsTimer" />
</Triggers>
<ContentTemplate>
// GridView to be updated
For the updatePanels, set UpdateMode to Conditional
<asp:UpdatePanel ID="UpdatePanelMouseRegion" runat="server" UpdateMode="Conditional">
For more information: Creating a Simple ASP.NET Page with Multiple UpdatePanel Controls

Modalpopupextender not firing

I am doing research to the Modalpopupextender from the Ajax Toolkit.
This code doesn't work, it doesn't open the pop-up. The only thing what happens when I click on the button is: Refreshing the page.
What am I doing wrong? Also tried this with an Updatepanel... Did 3 hours of research before posting this question, please don't blame it on me...
I also used the Toolkitscriptmanager, but that didn't solve it.
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:Button ID="btnTest" runat="server" Text="Button" />
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="btnTest" PopupControlID="Panel"></asp:ModalPopupExtender>
<asp:Panel ID="Panel" runat="server">
<h1>Hello World!</h1>
</asp:Panel>
Use PostBackTrigger for the button and then check it out .:)
Example:
<asp:UpdatePanel ID="updatePanel1" runat="server">
<ContentTemplate>
<asp:Button ID="btnTest" runat="server" Text="Button" />
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="btnTest" PopupControlID="Panel"></asp:ModalPopupExtender>
<asp:Panel ID="Panel" runat="server">
<h1>Hello World!</h1>
</asp:Panel>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="btnTest"/>
</Triggers>
</asp:UpdatePanel>

Working with multiple update panels and timer dedicated to specific updatepanel

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.

Categories