Ticket #865 (new defect)

Opened 4 months ago

Last modified 2 months ago

Dynamically rendered TLabel and TActiveLabel do not render control ids

Reported by: edward stow Owned by: xue
Priority: normal Milestone: 3.1.3
Component: Prado Framework v3 Version: 3.1
Severity: minor Keywords:
Cc:

Description

Dynamically created TLabel and TActiveLabel do not render their control ids. This becomes a problem for updating active controls as the updater expects to be able to locate the control by id. Example attached. Change the text in the first textbox. Note that by comparison the second TActiveTextBox is updated as expected.

Using prado-3.1.2.r2448

<html>
  <body>
    <com:TForm>
		
<com:TLabel
		Text="Statically generated label - does not have an id" />
<br /> <br />

<com:TPanel ID="ControlHolder" />

<br /> <br />

<com:TJavascriptLogger />

    </com:TForm>
  </body>
</html>
<?php

Prado::using('System.Web.UI.ActiveControls.*');

class labelErrorReport extends TPage
{
	public $label;
	public $textBox;
	
	public function onLoad($param)
	{
		parent::onLoad($param);

		$controls = $this->ControlHolder->getControls();

		$txtBox = new TActiveTextBox();
		$txtBox->setText("Dynamically generated");
		$txtBox->AutoPostBack = true;
		$txtBox->OnTextChanged = array($this, 'onTextChanged');
		$controls->add($txtBox);
		
		$controls->add('<br /><br />');

		$this->label = new TActiveLabel();
		$this->label->setText("Dynamically generated");
		$controls->add($this->label);
		
		$controls->add('<br /><br />');

		$this->textBox = new TActiveTextBox();
		$this->textBox->setText("Dynamically generated");
		$controls->add($this->textBox);		
	}
	
	public function onTextChanged($sender, $param)
	{
		$this->label->setText($sender->getText());
		$this->textBox->setText($sender->getText());		
	}
}

?>

Change History

Changed 2 months ago by knut

  • milestone set to 3.1.3
Note: See TracTickets for help on using tickets.