.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

fire event on timer

Posted By:      Posted Date: October 05, 2010    Points: 0   Category :ASP.Net

i have a form in asp.net. I want to fire 

ButtonSubmit_Click  event on code behind at a particular point of time. I have to fire following event automatically on a specific period of time like 30 minutes.

protected void ButtonSubmit_Click(object sender, EventArgs e)
 // some coding to insert data in to database

can we use ajax timer for this if so how can we use it ?
or there is any other way for this. please let me know. thanks

View Complete Post

More Related Resource Links

jquery click event doesn't fire after postback anymore

Hello there,I have a small website where I want to display a confirmation dialog after clicking on a button.When you click the confirmButton the dialog appears. Then you can choose between Yes or No to either continue with the PostBack or to return.Problem: The first time you get into the site all works fine. But after you click Yes to continue with the PostBack, no click event will be triggered anymore.Here is some code.<asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <script type="text/javascript"> function loadConfirmDialog() { //Dialog configurieren jQuery('#confirmDialog').dialog({ autoOpen: false, width: 400, modal: true, resizable: false }); //Dialog öffnen jQuery('#confirmButton').bind('click', function () { jQuery('#confirmDialog').dialog('open'); return false; }); //Postback ausführen jQuery('#continueButton').bind('click', function () { jQuery('#confrimDialog').dialog('destroy'); __doPostBack('confirmButton', ''); }); //Postback abbrechen jQuery('#cancel

Custom event does not fire

Hello,I have a base server control class for all my user controls. Inside this class I have the following declaration:#region Event Handling Management public event EventHandler ItemSaved; public event EventHandler ItemCancelled; protected virtual void OnItemSaved(EventArgs e) { if (this.ItemSaved != null) { this.ItemSaved(this, e); } } protected virtual void OnItemCancelled(EventArgs e) { if (this.ItemCancelled != null) { this.ItemCancelled(this, e); } } #endregion Concrete user controls used in the application are used always inside a ModalPopupExtender object and the popup it is always handled with server-side code. This means that there are no controls binded to the OkControlID and CancelControlID properties of the ModalPopupExtender.The responsibility to show the Modal Popup is then given to the aspx that has code like thisin the ASPX file...<gsl:PhoneNumberUC ID="ucPhoneDetail" runat="server" />in code behind...protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //Bind to the event handler ucPhoneDetail.ItemSaved += new EventHandler(ucPhoneDetail_ItemSaved); ucPhoneDetail.ItemCancelled += new EventHandler(ucPhoneDetail_ItemCancelled); } } protected void btnNewPhone_Click(object sender, EventArgs e) { //Show the Modal Popup this.mpePopupPhone.Show(

get url from server and fire event

i want to open new window ,but i dont want to provide url link in script because i want to hide this link from user.so is there any method to get URL from server and fire event to open new window after cliking button which has some server logic on that basis serever return URL. 

Cannot get Asyncfileupload to fire UploadComplete event... :(

hey everyone!I cannot get the asyncfileupload to fire the uploadcomplete event at all. I did a test:    Protected Sub AsyncFileUpload1_UploadedComplete(ByVal sender As Object, ByVal e As AjaxControlToolkit.AsyncFileUploadEventArgs) Handles AsyncFileUpload1.UploadedComplete         Dim currentUser As MembershipUser = Membership.GetUser()         Dim currentUserId As Guid = CType(currentUser.ProviderUserKey, Guid)         errorLabel.Text = "Test"     End Sub    Protected Sub AsyncFileUpload1_UploadedComplete(ByVal sender As Object, ByVal e As AjaxControlToolkit.AsyncFileUploadEventArgs) Handles AsyncFileUpload1.UploadedComplete       errorLabel.Text = "Test"    End Suband... nothing. The background turns green, my throbber activates successfully.. but then, I get nothing. It doesnt even make it to the uploadedComplete event. I also did the same test in the error event.. and still nothing. Any ideas??

DataGrid Button + event in Footer, event not getting fire!

hi.First Time i am trying this...I have one Datagrid with Footer. Footer Row Contains Input fields with one Button to add New Values. I have button click event but not getting fires. my code follows:protected void dgPrice_ItemCreated(object sender, DataGridItemEventArgs e)    {            Button btnAdd = new Button();            btnAdd.Text = "Add";            btnAdd.Width = 80;            btnAdd.ID = "btnAdd";           // btnAdd.Attributes.Add("onClick", "return validateRates()");            btnAdd.CommandName = "add";            btnAdd.CommandArgument = e.Item.ItemIndex.ToString();            btnAdd.Command +=new CommandEventHandler (PriceNew);            e.Item.Cells[6].Controls.Add(btnAdd);}protected void PriceNew(object sender, EventArgs e)    {}btnAdd.command/ btnAdd.click event not getting fired I also tried to

OnItemCommand event won't fire

My formview OnItemCommand event . What do I need to do to capture this event?  <asp:FormView ID="fvMemberDetail" runat="server" DataKeyNames="Ident" EnableViewState="False" OnItemUpdating="fvMemberDetail_OnUpdating" OnItemCommand="fvMemberDetail_ItemCommand" OnItemInserting="fvMemberDetail_OnInserting" >  protected void fvMemberDetail_ItemCommand(object source, FormViewCommandEventArgs e) { if (e.CommandName.ToString() == "Insert") { MemberInfoInserting(); DlMembers.Visible = true; fvMemberDetail.Visible = false; } if (e.CommandName.ToString() == "Update") { MemberInfoUpdating1(); DlMembers.Visible = true; fvMemberDetail.Visible = false; } } Thanks for your suggestions. EJM

AsyncFileUpload1_UploadedComplete event doesn't fire :(

I have a multi view with 2 view in my page. when page is loading first view is set active. by click on a click I set active second view that contain AsyncFileUpload1. but UploadedComplete event doesn't fire. This control works outside of view correctly but into view doesn't work. I have to use multi view and this 2 view in my web page. what can I do? please solution ...

Add my custom page and how to fire event


Hello All,

I am new to MVC. I created an application in which I am able to do login. I have used the basic template provided by MS. Now, I have to use registration template. But I need more fields than they have provided in their basic template. I am trying to add my fields manually on register.aspx, but its throwing an error. I tried to add a new content page in shared folder under view, but dont know how the event of register button will handle in controller.

Please suggest me what I have to do? Still I am not sure, what I am doing is the right way or not.

Thanks in Advance

Prateek Bindal

Programmatically generated AsyncFileUpload does not fire UploadedComplete event


The AsyncFileUpload control turns green, indicating that the attachment was successfully uploaded, but the designated method for handling the server side UploadedComplete event is never executed.

ListView, DataPager, LinqDataSource: LinqDataSource Selecting event fire twice


Dear all,

In my web app, I used LinqDataSource, ListView and DataPager (.NET 3.5 sp1) to implement search feature with paging. I have a button to trigger the search.

But In the first time, the Selecting event of LinqDataSource fire twice and I don't know why (I debugged my code very carefully). I don't use QueryString with DataPager and assign PageSize of DataPager in the first time of page load to prevent the ListView bind again (as in some instructions I found in forum)

Have anyone seen this problem before? And If possible, can you give me some instructions to try?

I can't post my code because it's quite large.

Thank you very much


Developer, CSC Vietnam


Fire a dropdownlist event?


 Hi, I want to fire an event and fill some data but no idea.Thanks for hints.

The web page code.

<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="StateChart.aspx.cs" Inherits="StateChartList"  Title="Untitled Page" %>

<%@ Register Assembly="WebChart" Namespace="WebChart" TagPrefix="Web" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:DropDownList ID="ddState" runat="server" AutoPostBack="True" >
    <asp:ListItem Value="AL" Text="Alabama"></asp:ListItem>
<asp:ListItem Value="AK" Text="Alaska"></asp:ListItem>
<asp:ListItem Value="AZ" Text="Arizona"></asp:ListItem>
<asp:ListItem Value="AR" Text="Arkansas"></asp:ListItem>
<asp:ListItem Value="CA" Text="California"></asp:ListItem>
<asp:ListItem Value="CO" Text="Colorado"></asp:ListItem>
<asp:ListItem Value="CT" Text="Connecticut"></asp:ListItem>
<asp:ListItem Value="DE&qu

FormView: Button requires 2 click to fire the event



I have a modal formview with insertitemtemplate.
I have to click the insert button twice to fire the event.

But if I do not insert any values, only one click is required and the validationgroup fires.
But if I enter all valid values, I need to click twice and the event does not fire during the
first click. But I need CausesValidation = false because to required field validators.

How to avoid two clicks to fire the event if the formview is valid

Any input on how to handle this is greatly appreciated.


 protected void FormViewInsertApplication_ItemCommand(object sender, FormViewCommandEventArgs e)
        if (e.CommandName == "InsertApp")
            // Must explicitly cause validation because update button causevalidation is set to false   
            if (!Page.IsValid)
             if (!doValidate()) { return; }

<asp:FormView id="FormViewInsertApplication">
       <asp:Button ID="btnInsert" runat="server" Text="Insert" CommandName="InsertApp"   	   		                         

Run Code/Fire Event After First Event Finishes

I have a form with an ActiveX control on it. When the disconnect event of the OCX runs, I want to close the form. The problem is, if I call the close command from within the disconnect event, I get an access violation as the form/control is disposed of when the OCX event finishes up.

OCX Disconnect Event
Custom EventHandler for OCX Disconnect Event
Clean up all connections and close form
Form Close Event
Form is closed and all controls are disposed of
Exception thrown as the parent form no longer exists

I just need to make the Clean up all connections and close form function run after OCX Disconnect Event, but I don't know how or if its possible. Any help or work arounds would be appreciated. Currently, my only work around is basically to leave the parent form open and have the user close it.

If it helps any, this form is a child of a master MDI form.

Why is there a postback with every timer event?


The handler for my timer event checks the status of a table in my database.  If there is any change, it causes a redirection of the web page to occur so that the change will be displayed.  But, when the timer event handler ends without any change, it still causes the page to be re-posted with every tick.  Why?  How can I conclude each timer event without causing a postback, which interferes with the user's ability to scroll down and view the entire page?



OnTaskChanged event doesn't fire after SPWorkflowTask.AlterTask

Hi guys

I've been following Robert Shelton's tutorial on creating an approval workflow, but ran into an issue I'm having a hard time resolving.  After the approval task is created, we create a While loop and wait for a private member, 'taskCompleted', to equal true before completing the task.  Within the while loop is an OnTaskChanged that should set taskComplete = true and exit the loop.  Once we exit the loop, CompleteTask runs and finishes my workflow.

In other words, this is what the flow looks like:

CreateTaskWithContentType -> OnTaskCreated -> WhileActivity -> OnTaskChanged -> CompleteTask

I'm debugging my workflow in VS, but never hit the WhileActivity->OnTaskChanged section.  I tried disabling the OnTaskCreated step and now find that I do hit the WhileActivity step when initially starting the workflow.  However, once the content approver returns to the workflow and clicks either Approve or Reject (in either case, we run a "SPWorkflowTask.AlterTask" method), OnTaskChanged doesn't fire.

Any ideas what the issue is or how to further investigate?

Tks in advance

Timer onTick event not being triggered... why?


Hi all,

I am trying to modify the Interval and Enabled properties via ViewState but it is not working.
Here is my code:

protected void Page_Load(object sender, EventArgs e)
if (!Page.IsPostBack)
//set the default Refresh Interval to 3 seconds and enable Timer to TRUE
ViewState["TimerEnable"] = true;
ViewState["RefreshInterval"] = 3000;


    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">     

         <asp:Timer ID="Timer1" OnTick="Timer1_Tick" runat="server"
            Enabled  = <%# Convert.ToBoolean(ViewState["TimerEnable"].ToString()) %>
            Interval = <%# Convert.ToInt32(ViewState["RefreshInterval"].ToString()) %> >

How do I make a DataGrid fire an event when a cell is changed?


I tried to figure this out a while ago but gave up - now I'm in a situation where I need to try again.

I have a DataGrid (using .NET 4) and I'm trying to fire an event when a cell is changed.  However, I cannot generate any events until a different row is selected.  So, for example, I have a datagrid with a checkbox column and I want an event to occur when the user changes one of the checkboxes.  As it is right now, I can't generate an event until the user selects another row after changing the checkbox.

I've tried every type of event I can find - RowEditEnding, CellEditEnding, CurrentCellChanged, MouseLeftButtonUp, MouseLeftButtonDown, etc.  None is ever fired when the checkbox is changed - they don't fire until another row is selected.

So, I can click away on a checkbox hundreds of times and no events will be generated.  As soon as I change rows, though, the events occur.

Any help with this one?  This is such an elementary problem I'm sure there's something basic I'm missing.  Suffice it to say, I don't use WPF very often :)  I've seen the same question asked elsewhere and there are supposed answers but they are extremely complicated and I can't get them to work.

Thanks in advance,


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend