Show values in TDropDownList in PRADO.
- by Muhammad Sajid
I m new to PRADO, I have a file
Home.page with code:
<%@ Title="Contact List" %>
<h1>Contact List</h1>
<a href="<%= $this->Service->constructUrl('insert')%>">Create New Contact</a>
<br/>
<com:TForm>
<com:TDropDownList ID="personInfo">
<com:TListItem Value="value 1" Text="item 1" />
<com:TListItem Value="value 2" Text="item 2" Selected="true" />
<com:TListItem Value="value 3" Text="item 3" />
<com:TListItem Value="value 4" Text="item 4" />
</com:TDropDownList>
</com:TForm>
& Home.php with code
<?php
class Home extends TPage
{
/**
* Populates the datagrid with user lists.
* This method is invoked by the framework when initializing the page
* @param mixed event parameter
*/
public function onInit($param)
{
parent::onInit($param);
// fetches all data account information
$rec = ContactRecord::finder()->findAll();
}
}
?>
the $rec contain array of all values.
Now I want to show all name in Dropdown list. I tried my best but fail.
Can anyone help me?
Thanks