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
You can populate the DataTextField and DataValueField of the dropdownlist with the database table column names to use as the TListItem’s text and value respectively:
Alternatively, you can do it in the HTML front-end:
This way, you only need to specify the
DataSourceproperty and call theDataBind()method in your back-end code.