Click here to Skip to main content
15,886,199 members
Home / Discussions / C#
   

C#

 
GeneralRe: Who can help on this C# Proj??? Urgent Pin
Gerry Schmitz3-Aug-10 20:16
mveGerry Schmitz3-Aug-10 20:16 
QuestionChart Controls in C# Pin
annmarypaul30-Jul-10 17:30
annmarypaul30-Jul-10 17:30 
Questionc# datetime timezone issues Pin
LimitedAtonement30-Jul-10 11:38
LimitedAtonement30-Jul-10 11:38 
AnswerRe: c# datetime timezone issues Pin
PIEBALDconsult30-Jul-10 18:39
mvePIEBALDconsult30-Jul-10 18:39 
Questioniframe in MasterPage Pin
brunoseixas30-Jul-10 9:07
brunoseixas30-Jul-10 9:07 
AnswerRe: iframe in MasterPage Pin
Dave Kreskowiak30-Jul-10 9:47
mveDave Kreskowiak30-Jul-10 9:47 
AnswerRe: iframe in MasterPage Pin
Xmen Real 31-Jul-10 6:34
professional Xmen Real 31-Jul-10 6:34 
Question[MOSS 2007 C# WebPart] Timer/UpdatePanel, help please... Pin
crosslink0630-Jul-10 5:07
crosslink0630-Jul-10 5:07 
Hi all,

I'm developing a custom WebPart written in C# for MS Project EPM 2007 (Sharepoint 2007 engine), using Visual studio 2008, VseWss 1.3 and the .Net framework 3.5.
I also installed the ASPAJAXExtSetup.msi file and added the AjaxToolKit.dll binary into my project.

My Webpart display a simple DateTime.Now (among others). I wish to use an updatePanel and a Timer to refresh my string every second but unfortunately it doesn't work...

Here is my code:

protected override void CreateChildControls()
        {
            base.CreateChildControls();

            try
            {

                if (ScriptManager.GetCurrent(this.Page) == null)
                {
                this.Controls.Add(new ScriptManager()
                {

                    EnablePartialRendering = true
                });
                }

                

                UpdatePanel updatePanel = new UpdatePanel();
                updatePanel.UpdateMode = UpdatePanelUpdateMode.Always;
                this.Controls.Add(updatePanel);
                

                lblTimer = new Label();
                lblTimer.Text = DateTime.Now.ToString();
                updatePanel.ContentTemplateContainer.Controls.Add(lblTimer);

                

                Timer timer = new Timer();
                timer.Enabled = true;
                timer.Interval = 2000;
                timer.Tick += new EventHandler<EventArgs>(t_Tick);
                

            }
            catch (Exception ex2)
            {
                Literal ex2b = new Literal();
                ex2b.Text = ex2.ToString();
                this.Controls.Add(ex2b);
            }

}



        protected void t_Tick(object sender, EventArgs e)
        {
            lblTimer.Text = DateTime.Now.ToLongTimeString();
        }



What is the problem?

Thanks in advance
AnswerRe: [MOSS 2007 C# WebPart] Timer/UpdatePanel, help please... Pin
Luc Pattyn30-Jul-10 5:53
sitebuilderLuc Pattyn30-Jul-10 5:53 
AnswerRe: [MOSS 2007 C# WebPart] Timer/UpdatePanel, help please... Pin
Not Active30-Jul-10 7:33
mentorNot Active30-Jul-10 7:33 
GeneralRe: [MOSS 2007 C# WebPart] Timer/UpdatePanel, help please... Pin
crosslink0630-Jul-10 23:50
crosslink0630-Jul-10 23:50 
GeneralRe: [MOSS 2007 C# WebPart] Timer/UpdatePanel, help please... Pin
crosslink0631-Jul-10 4:36
crosslink0631-Jul-10 4:36 
GeneralRe: [MOSS 2007 C# WebPart] Timer/UpdatePanel, help please... Pin
Not Active31-Jul-10 13:44
mentorNot Active31-Jul-10 13:44 
GeneralRe: [MOSS 2007 C# WebPart] Timer/UpdatePanel, help please... [modified] Pin
crosslink061-Aug-10 2:08
crosslink061-Aug-10 2:08 
GeneralRe: [MOSS 2007 C# WebPart] Timer/UpdatePanel, help please... Pin
Not Active1-Aug-10 5:59
mentorNot Active1-Aug-10 5:59 
GeneralRe: [MOSS 2007 C# WebPart] Timer/UpdatePanel, help please... [modified] Pin
crosslink061-Aug-10 12:39
crosslink061-Aug-10 12:39 
GeneralRe: [MOSS 2007 C# WebPart] Timer/UpdatePanel, help please... Pin
Not Active1-Aug-10 16:35
mentorNot Active1-Aug-10 16:35 
GeneralRe: [MOSS 2007 C# WebPart] Timer/UpdatePanel, help please... [modified] Pin
crosslink062-Aug-10 23:45
crosslink062-Aug-10 23:45 
GeneralRe: [MOSS 2007 C# WebPart] Timer/UpdatePanel, help please... Pin
crosslink065-Aug-10 7:47
crosslink065-Aug-10 7:47 
QuestionSQL Query On DataTable Pin
cdpace30-Jul-10 4:07
cdpace30-Jul-10 4:07 
AnswerRe: SQL Query On DataTable Pin
Yusuf30-Jul-10 5:43
Yusuf30-Jul-10 5:43 
QuestionProgrammatically set the admin only permission to event viewer file in window 7 Pin
vinaykhin30-Jul-10 1:29
vinaykhin30-Jul-10 1:29 
AnswerRe: Programmatically set the admin only permission to event viewer file in window 7 Pin
vinaykhin17-Aug-10 21:59
vinaykhin17-Aug-10 21:59 
QuestionCOM server containing bulk insert impl called from Matlab Pin
devvvy29-Jul-10 23:51
devvvy29-Jul-10 23:51 
QuestionReflection to load an assembly application wide (like referencing it) Pin
hoernchenmeister29-Jul-10 23:38
hoernchenmeister29-Jul-10 23:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.