Ax EP – AxBoundField – OnDataChange Event
Here I want to achieve, if the AxBoundField have some value, need to enable/disable button accordingly.
I had struggled little bit, to raise the event OnDataChanged for AxBoundField control when data changed for this bound control.
Then, have used following markup code for Bound control.
<dynamics:AxGroup ID="AxFieldGroupDefaultsProject" runat="server"
Caption="<%$ AxLabel:@SYS4534 %>">
<Fields>
<dynamics:AxBoundField DataSet="TrvExpTableNew" DataSetView="TrvExpTable"
DataField="ProjId" SortExpression="ProjId" AutoPostBack="true" OnDataChanged="ProjId_OnDataChanged"/>
</Fields>
</dynamics:AxGroup>
While adding the bound fields to the AxForm, we won’t get this attribute AutoPostBack="true" to the AxBoundField.
To raise the OnDataChanged event, explicitly need to add the above attribute to AxBoundField.
Then I had added the following code to the event …
protected void ProjId_OnDataChanged(object sender, AxBoundFieldDataChangedEventArgs e)
{
string expProjId = ((System.Web.UI.WebControls.TextBox)(e.BoundControl)).Text.ToString();
if (expProjId != "")
{
ButtonOK.Enabled = true;
}
else
{
ButtonOK.Enabled = false;
}
}
..
Hi Santosh!
The same procedure I am using to fire the event but its not occuring. My AxBoundField in of type “Date”. I have to select date, and as I do select the date, the event should fire….. I am setting the AutoPostBack property to “true”.
Am I missing something?
Looking forward to your response, thanks in advance!
Ehtasham Ur Rahman.
Good example. It work!