TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
william jones
NA
1
0
can not build timer into update panel in c#
Nov 18 2010 10:54 AM
I am trying to add a timer control into an update panels content template. I can do this under the web design using the following ( example 1) so that it will only update the panel that it is in.
when I try to build it under c# using the following ( example 2) it will not build the timer into the update panel so it updates the entire page.
Im new to c# so this is a extreme learning curve! every spare minute is spent doing a lot of online reading and training!
example 1
<
body
>
<
form
id
="Form1"
runat
="server">
<
<
asp
:
ScriptManager
ID
="CitySystemScript"
runat
="server">
</
asp
:
ScriptManager
>
<
asp
:
UpdatePanel
ID
="CitySystemPanel"
runat
="server">
<
ContentTemplate
>
<
asp
:
Timer
ID
="cityTimer"
runat
="server"
Interval
="30000"></
asp
:
Timer
>
</
ContentTemplate
>
</
asp
:
UpdatePanel
>
example 2
// Build the scriptmanager to activate the asp page
ScriptManager
scriptmanager =
new
ScriptManager
();
scriptmanager.ID =
"scriptmanager1"
;
form1.Controls.Add(scriptmanager);
// Create Panel to hold sites
Panel
CitySystemPanel =
new
Panel
();
CitySystemPanel.Style.Add(
HtmlTextWriterStyle
.Position,
"absolute"
);
CitySystemPanel.Style.Add(
HtmlTextWriterStyle
.Height,
"200px"
);
CitySystemPanel.Style.Add(
HtmlTextWriterStyle
.Width,
"600px"
);
CitySystemPanel.Style.Add(
HtmlTextWriterStyle
.Left,
"1px"
);
CitySystemPanel.Style.Add(
HtmlTextWriterStyle
.Top,
"1px"
);
form1.Controls.Add(CitySystemPanel);
/* ---------------------------------------------------------------------------*/
// Labeling for the panel
Label
CitySystemTitle =
new
Label
();
CitySystemTitle.Text =
"City System"
;
CitySystemTitle.CssClass =
"systemname33xx"
;
CitySystemTitle.Style.Add(
HtmlTextWriterStyle
.Width,
"720px"
);
CitySystemPanel.Controls.Add(CitySystemTitle);
/* ---------------------------------------------------------------------------*/
// Create update container for Ajax
UpdatePanel
CitySystemUpdatePanel =
new
UpdatePanel
();
CitySystemUpdatePanel.ID =
"CitySystemUpdatePanel"
;
CitySystemPanel.Controls.Add(CitySystemUpdatePanel);
/* ---------------------------------------------------------------------------*/
// timer to trigger update
Timer
CitySystemTimer =
new
Timer
();
CitySystemTimer.ID =
"CityTimer"
;
CitySystemTimer.Interval = 30000;
CitySystemTimer.Enabled =
true
;
CitySystemUpdatePanel.ContentTemplateContainer.Controls.Add(CitySystemTimer);
This page is generated completely using c# so i can not just split the web and the c#
Any Ideas would be great!
Jeff
Reply
Answers (
0
)
Should i use server controls or javascript DOM for implemeting AJAX?
drag and drop controls with ajax toolkit