Click here to Skip to main content
15,915,328 members
Home / Discussions / Web Development
   

Web Development

 
QuestionReg:Google API Calendar Permission Pin
P.T.R.K5-Jun-09 22:05
P.T.R.K5-Jun-09 22:05 
Questionsearching for v.good web hosting service Pin
Mohammad A Gdeisat5-Jun-09 17:30
Mohammad A Gdeisat5-Jun-09 17:30 
AnswerRe: searching for v.good web hosting service Pin
Abhijit Jana5-Jun-09 18:23
professionalAbhijit Jana5-Jun-09 18:23 
AnswerRe: searching for v.good web hosting service Pin
Kapil Thakur5-Jun-09 21:49
Kapil Thakur5-Jun-09 21:49 
GeneralRe: searching for v.good web hosting service Pin
Mohammad A Gdeisat6-Jun-09 1:05
Mohammad A Gdeisat6-Jun-09 1:05 
GeneralRe: searching for v.good web hosting service Pin
Kapil Thakur6-Jun-09 1:15
Kapil Thakur6-Jun-09 1:15 
AnswerRe: searching for v.good web hosting service Pin
Aman Bhullar6-Jun-09 1:32
Aman Bhullar6-Jun-09 1:32 
QuestionWebControl isn't working at all. Please help me. I have tryed it for several days.. [modified] Pin
valmirpaixao5-Jun-09 4:58
valmirpaixao5-Jun-09 4:58 
Hi guys,
I’ve worked trying to solve this problem for several days, but, unfortunately I couldn’t.
Image this situation:

1. I have several Web Pages with several control labels.
2. Each label has a value that need to be updated each 5 seconds automatically. This new values will come from a database.
3. I’m trying to develop a WEB Page control to get the newest values from my database and after that update each label.
4. I’m a beginner programmer, so I was trying to do a simple control first. This control should create a scriptmanger, updated panel and timer programmatically and after that update this label with de system time.
5. Someone could help to solve this problem? I've worked hard at this problem for several days, but without success.

Thanks. Valmir

See my code below.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ServerControl
{
[DefaultProperty("Text")]
[ToolboxData("<{0}:ServerControl1 runat=server></{0}:ServerControl1>")]
public class ServerControl1 : WebControl
{
ScriptManager sm;
private UpdatePanel _updatePanel = null;
private Label _targetLabel = new Label();

private Timer _timer= new Timer();
AsyncPostBackTrigger _ap1 = new AsyncPostBackTrigger();
private Control _controlContainer = new Control();



protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);

//Se a página não tiver um scripmanager ira criar um novo
//If this page has no scriptmanger I will create one.
sm = ScriptManager.GetCurrent(this.Page);
if (sm == null)
{
sm = new ScriptManager();
base.Controls.AddAt(0, sm);
}

//Cria um label que será usado para receber a horário atual a cada um segundo.
// This label will be used to receive the system time each second.
_targetLabel.Text = "Teste";
_targetLabel.ID = "Paixao";
_controlContainer = _updatePanel.ContentTemplateContainer;
_controlContainer.Controls.Add(_targetLabel);


//Timer que ira atualizar o label que esta dentro do update panel. Será atualizado a cada 1 segundo.
//This is the timer will trigger the update panel each second.
_timer.Interval = 1000;
_timer.Tick += new EventHandler<EventArgs>(_timer_Tick);
_ap1.ControlID = _timer.ID;
_ap1.EventName = "Tick";
_updatePanel.Triggers.Add(_ap1);


//Adiciona o update panel a coleção de controles
//ADD the update panel to control collections.
base.Controls.Add(_updatePanel);
}




protected override void Render(HtmlTextWriter output)
{
base.Render(output);
}


private void _timer_Tick(object sender, EventArgs e)
{
_targetLabel.Text = System.DateTime.Now.ToString();

}


}
}

modified on Friday, June 5, 2009 12:32 PM

AnswerRe: WebControl isn't working at all. Please help me. I have tryed it for several days.. Pin
Christian Graus5-Jun-09 23:38
protectorChristian Graus5-Jun-09 23:38 
QuestionASP session expire issue Pin
George_George4-Jun-09 22:16
George_George4-Jun-09 22:16 
AnswerRe: ASP session expire issue Pin
J4amieC5-Jun-09 0:21
J4amieC5-Jun-09 0:21 
GeneralRe: ASP session expire issue Pin
led mike5-Jun-09 9:03
led mike5-Jun-09 9:03 
GeneralRe: ASP session expire issue Pin
PrestonMB5-Jun-09 17:03
PrestonMB5-Jun-09 17:03 
QuestionCrystal report from typed dataset problem Pin
Tim@Headcount4-Jun-09 13:47
Tim@Headcount4-Jun-09 13:47 
AnswerRe: Crystal report from typed dataset problem Pin
David Mujica5-Jun-09 2:54
David Mujica5-Jun-09 2:54 
GeneralRe: Crystal report from typed dataset problem Pin
Tim@Headcount5-Jun-09 6:15
Tim@Headcount5-Jun-09 6:15 
QuestionError code: ssl_error_rx_record_too_long when using SSL Pin
A k ch3-Jun-09 23:15
A k ch3-Jun-09 23:15 
AnswerRe: Error code: ssl_error_rx_record_too_long when using SSL Pin
Baku_ra15-Sep-10 9:28
Baku_ra15-Sep-10 9:28 
QuestionWhat are the best practice for Web UI Development?? Pin
Ponzano Paolo3-Jun-09 23:05
Ponzano Paolo3-Jun-09 23:05 
AnswerRe: What are the best practice for Web UI Development?? Pin
Paddy Boyd4-Jun-09 6:04
Paddy Boyd4-Jun-09 6:04 
QuestionRe: What are the best practice for Web UI Development?? Pin
led mike4-Jun-09 7:51
led mike4-Jun-09 7:51 
QuestionUpdate web site using dreamweaver Pin
Norman223-Jun-09 18:18
Norman223-Jun-09 18:18 
AnswerRe: Update web site using dreamweaver Pin
Marc Firth3-Jun-09 22:06
Marc Firth3-Jun-09 22:06 
QuestionPhoto Editing Plugin -- Any Ideas? Pin
Horrorshow803-Jun-09 9:13
Horrorshow803-Jun-09 9:13 
AnswerRe: Photo Editing Plugin -- Any Ideas? Pin
Mohammad Al Hoss3-Jun-09 11:59
Mohammad Al Hoss3-Jun-09 11:59 

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.