<asp:TemplateField ConvertEmptyStringToNull="False" HeaderText="Recruiter"
SortExpression="Recruiter">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("custRecruiter") %>'> >
</asp:TextBox>
<dynamics:AxLookup ID="AxLookup1" runat="server" TargetControlId="TextBox1"
onlookup="WorkOrdersLookup_Lookup" RunLookupDataSetWhenOkClicked="True"
AutoPostBack="False">
</dynamics:AxLookup>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("custRecruiter") %>'>>
</asp:Label>
</ItemTemplate>
</asp:TemplateField>
using Microsoft.Dynamics.Framework.BusinessConnector.Session;
using Proxy = Microsoft.Dynamics.Framework.BusinessConnector.Proxy;
using Microsoft.Dynamics.AX.Framework.Services.Client;
using Microsoft.Dynamics.AX.Framework.Portal.Data;
private ISession AxSession
{
get
{
AxBaseWebPart webpart = AxBaseWebPart.GetWebpart(this);
return webpart == null ? null : webpart.Session;
}
}
protected void WorkOrdersLookup_Lookup(object sender, AxLookupEventArgs e)
{
AxLookup lookup = (AxLookup)sender;
// Create the lookup data set. The DirParty table will be used.
Proxy.SysDataSetBuilder sysDataSetBuilder;
sysDataSetBuilder = Proxy.SysDataSetBuilder.constructLookupDataSet(AxSession.AxaptaAdapter, TableMetadata.TableNum(AxSession, "DirPartyTable"));
// Set the generated data set as the lookup data set.
lookup.LookupDataSet = new DataSet(AxSession, sysDataSetBuilder.toDataSet());
//filter the lookup
using (Proxy.Query query = lookup.LookupDataSet.DataSetViews[0].MasterDataSource.query())
{
// If the partyName is blank we assign the "*" as the range
query.dataSourceNo(1).addRange(TableDataFieldMetadata.FieldNum(this.AxSession, "DirPartyTable", "Name")).value = "Ajay";
}
// Specify the fields for the lookup.
lookup.Fields.Add(AxBoundFieldFactory.Create(AxSession, lookup.LookupDataSetViewMetadata.ViewFields["Name"]));
// Specify the select field for the lookup.
lookup.SelectField = "Name";
}
SortExpression="Recruiter">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("custRecruiter") %>'> >
</asp:TextBox>
<dynamics:AxLookup ID="AxLookup1" runat="server" TargetControlId="TextBox1"
onlookup="WorkOrdersLookup_Lookup" RunLookupDataSetWhenOkClicked="True"
AutoPostBack="False">
</dynamics:AxLookup>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("custRecruiter") %>'>>
</asp:Label>
</ItemTemplate>
</asp:TemplateField>
using Microsoft.Dynamics.Framework.BusinessConnector.Session;
using Proxy = Microsoft.Dynamics.Framework.BusinessConnector.Proxy;
using Microsoft.Dynamics.AX.Framework.Services.Client;
using Microsoft.Dynamics.AX.Framework.Portal.Data;
private ISession AxSession
{
get
{
AxBaseWebPart webpart = AxBaseWebPart.GetWebpart(this);
return webpart == null ? null : webpart.Session;
}
}
protected void WorkOrdersLookup_Lookup(object sender, AxLookupEventArgs e)
{
AxLookup lookup = (AxLookup)sender;
// Create the lookup data set. The DirParty table will be used.
Proxy.SysDataSetBuilder sysDataSetBuilder;
sysDataSetBuilder = Proxy.SysDataSetBuilder.constructLookupDataSet(AxSession.AxaptaAdapter, TableMetadata.TableNum(AxSession, "DirPartyTable"));
// Set the generated data set as the lookup data set.
lookup.LookupDataSet = new DataSet(AxSession, sysDataSetBuilder.toDataSet());
//filter the lookup
using (Proxy.Query query = lookup.LookupDataSet.DataSetViews[0].MasterDataSource.query())
{
// If the partyName is blank we assign the "*" as the range
query.dataSourceNo(1).addRange(TableDataFieldMetadata.FieldNum(this.AxSession, "DirPartyTable", "Name")).value = "Ajay";
}
// Specify the fields for the lookup.
lookup.Fields.Add(AxBoundFieldFactory.Create(AxSession, lookup.LookupDataSetViewMetadata.ViewFields["Name"]));
// Specify the select field for the lookup.
lookup.SelectField = "Name";
}