i have an radAutoCompleteBox and just can get the Text property, but i need the ID.
My AppData.cs method:
public IEnumerable<Company> GetAllCompanies()
{
_companyRepository = new CompanyRepository();
return _companyRepository.GetAll();
}
My InsertTemplate on .aspx file:
<telerik:RadAutoCompleteBox ID="acCompany" runat="server" EmptyMessage="Empresas..." AllowCustomEntry="False" RenderMode="Lightweight" DataSourceID="CompanyObjectDataSource" DataTextField="TradeName" DataValueField="IDCompany" />
And my DataSource on .aspx file:
asp:ObjectDataSource ID="CompanyObjectDataSource" runat="server" SelectMethod="GetAllCompanies" TypeName="Apontamento.DataSource"
And my .cs file:
protected void radGrid1_OnInsertCommand(object sender, GridCommandEventArgs e)
{
var item = e.Item as GridEditFormItem;
var company = (item.FindControl("acCompany") as RadAutoCompleteBox).Text;
var idCompany = (item.FindControl("acCompany") as RadAutoCompleteBox).DataValueField;
}
So, i just cant make the idCompany work. It always return the string value "IDCompany", and not the ID real value.
Any ideas?
Thanks!