Hi, I'm trying to use the RowExpanded server-side event to populate a pulldown list which appears within the 'Add New' row of the Bands section (the pulldown list needs to be populated before the user tries to make a selection). However, for some reason, the RowExpanded event isn't firing the code when I actually expand a row. Am I missing something obvious?
Can anyone help with this? It's vital that I'm able to populate a pulldown list when a row is expanded. My company is evaluating this software and a competitor's software - if this issue can't be resolved, then we may end up going with the competitor.
Hi MartinWright6,
I took a look at this. I attached RowIslandPopulating and RowExpanded server events. I got the first event with ajax set to true and false. I got the expanded event on the first (loading) postback when ajax was FALSE. However, when it is true, the RowExpanded event fires on the second postback. This is because the row has not actually expanded until it comes back from the ajax postback and expands on the client. So you have two choices. You could turn off enable ajax or you could try to handle row island populated to set up the pull down items. Let us know if you need any help.
regards,
David Young
Hi,
Your problem is that you have InitialDataBindDepth set to -1. This means everything is loaded on the client initially; there is no load on demand. The Row Expanded event on the server will not fire until the next postback. What you could do is handle the client side row expanded event and then find the drop down provider and call loadItems(params) on it. Or initiate some sort of postback.
-Dave
Hiya David,
Firstly, thanks for taking a look. Unfortunately, setting "EnableAjax" to false didn't seem to work - the code is still not firing. I've added my .aspx code below... could you take a look and let me know if you can spot the issue please?...
<head runat="server"> <title></title></head><body> <form id="form1" runat="server"> <div>
<asp:ScriptManager ID="ScriptManager1" runat="server"/> <asp:CheckBox ID="ChkIncludeInactive" runat="server" Text=" Include Inactive Items" AutoPostBack="true" Font-Names="Arial" Font-Size="Small" ForeColor="#FF3300" /> <br /> <br />
<ig:WebHierarchicalDataGrid ID="wdgResourceGroup" DataSourceID="whdResourceGroupList" runat="server" AutoGenerateColumns="False" StyleSetName="Harvest" DataKeyFields="ResourceGroupID" OnRowAdding="wdgResourceGroup_RowAdding" OnRowExpanded="wdgResourceGroup_RowExpanded" AutoGenerateBands="False" InitialDataBindDepth="-1" EnableAjax="False"> <ExpandCollapseAnimation SlideOpenDirection="Auto" SlideOpenDuration="300" SlideCloseDirection="Auto" SlideCloseDuration="400" />
<Columns> <ig:BoundDataField DataFieldName="ResourceGroupID" Key="ResourceGroupID" Hidden="true" DataType="System.Int32"/> <ig:BoundDataField DataFieldName="ResourceGroupDesc" Key="ResourceGroupDesc" DataType="System.String" Header-Text="Resource Group" Width="350" > <Header Text="Resource Group"></Header> </ig:BoundDataField> <ig:BoundCheckBoxField DataFieldName="Active" Header-Text="Active" DataType="System.Boolean" Key="Active" Width="60" > <Header Text="Active"></Header> </ig:BoundCheckBoxField> </Columns>
<Bands> <ig:Band DataMember="dvResourceGroupMemberList" AutoGenerateColumns="false" DataKeyFields="ResourceID"> <Columns> <ig:BoundDataField DataFieldName="ResourceGroupID" Key="ResourceGroupID" Hidden="true"/> <ig:BoundDataField DataFieldName="ResourceDesc" Key="ResourceDesc" > <Header Text="Resources"></Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="ResourceID" Key="ResourceID" Hidden="true"/> </Columns> <Behaviors> <ig:Sorting SortingMode="Single" Enabled="true" /> <ig:RowSelectors Enabled="true" RowNumbering="false" /> <ig:Filtering Alignment="Bottom" Visibility="Visible" Enabled="true" AnimationEnabled="true" AnimationDurationMs="1000" > <ColumnSettings> <ig:ColumnFilteringSetting ColumnKey="Active" Enabled="False" /> </ColumnSettings> </ig:Filtering> <ig:Paging PagerAppearance="Bottom" PageSize="10" PagerCssClass="igg_CustomPager" Enabled="true" PagerMode="Numeric" /> <ig:EditingCore> <Behaviors>
<ig:RowEditingTemplate CancelButton="buttonCancel" OKButton="buttonOK"> <ClientBindings> <ig:RowEditingClientBinding ColumnKey="ResourceDesc" ControlID="control1" GetValueJavaScript="$get({ClientID}).value" SetValueJavaScript="$get({ClientID}).value={value}" /> </ClientBindings> <Template> <div style="background-color: white; border: 1px solid black;"> <table border="0" class="customEditRowTable"> <tr> <td> <asp:Label ID="ResourceDescLabel" runat="server" Text="Resource Description: " /> </td> <td> <asp:TextBox ID="control1" runat="server"></asp:TextBox> </td> </tr> <tr> <td> </td> <td> <asp:Button ID="buttonOK" runat="server" OnClientClick="return" Text="OK" UseSubmitBehavior="False" /> <asp:Button ID="buttonCancel" runat="server" CausesValidation="False" OnClientClick="return" Text="Cancel" UseSubmitBehavior="False" /> </td> </tr> </table> </div> </Template> </ig:RowEditingTemplate>
<ig:RowAdding Alignment="Bottom" EditModeActions-EnableOnActive="true" EditModeActions-MouseClick="Single" Enabled="true" > <ColumnSettings> <ig:RowAddingColumnSetting ColumnKey="ResourceDesc" EditorID="UnassignedProvider" /> </ColumnSettings> </ig:RowAdding> </Behaviors> </ig:EditingCore> </Behaviors> </ig:Band> </Bands> <EditorProviders> <ig:DropDownProvider ID="UnassignedProvider" > <EditorControl ID="EditorControl1" runat="server" DisplayMode="DropDownList" TextField="ResourceDesc" Width="165px" DataSourceID="dsResourceGroupMemberUnassignedList"> <%--<ClientEvents DropDownOpening="DropDownOpening" />--%> </EditorControl> </ig:DropDownProvider> </EditorProviders>
<Behaviors> <ig:Activation Enabled="true"/> <ig:Sorting SortingMode="Single" Enabled="true" > <ColumnSettings> <ig:SortingColumnSetting ColumnKey="Active" Sortable="False" /> </ColumnSettings> </ig:Sorting> <ig:Filtering Alignment="Bottom" Visibility="Visible" Enabled="true" AnimationEnabled="true" AnimationDurationMs="1000" > <ColumnSettings> <ig:ColumnFilteringSetting ColumnKey="Active" Enabled="False" /> </ColumnSettings> </ig:Filtering> <ig:Paging PagerAppearance="Bottom" PageSize="10" PagerCssClass="igg_CustomPager" Enabled="true" PagerMode="Numeric" /> <ig:EditingCore> <Behaviors> <ig:CellEditing Enabled="True" EditModeActions-MouseClick="Single"> <ColumnSettings> <ig:EditingColumnSetting ColumnKey="ResourceGroupID" ReadOnly="true" /> <ig:EditingColumnSetting ColumnKey="ResourceGroupDesc" /> <ig:EditingColumnSetting ColumnKey="ResourceID" ReadOnly="true" /> </ColumnSettings> </ig:CellEditing> <ig:RowAdding Alignment="Bottom" EditModeActions-EnableOnActive="true" EditModeActions-MouseClick="Single" Enabled="true" > <ColumnSettings> <ig:RowAddingColumnSetting ColumnKey="Active" DefaultValueAsString="true" /> </ColumnSettings> </ig:RowAdding> <ig:RowDeleting Enabled="True" /> </Behaviors> </ig:EditingCore> </Behaviors>
</ig:WebHierarchicalDataGrid> <ig:WebHierarchicalDataSource ID="whdResourceGroupList" runat="server"> <DataRelations> <ig:DataRelation ParentColumns="ResourceGroupID" ParentDataViewID="dvResourceGroupList" ChildColumns="ResourceGroupID" ChildDataViewID="dvResourceGroupMemberList" /> </DataRelations> <DataViews> <ig:DataView ID="dvResourceGroupList" DataSourceID="dsResourceGroupList" /> <ig:DataView ID="dvResourceGroupMemberList" DataSourceID="dsResourceGroupMemberList" /> </DataViews> </ig:WebHierarchicalDataSource> <asp:SqlDataSource runat="server" ID="dsResourceGroupList" ProviderName="System.Data.SqlClient" connectionString="Password=password;Persist Security Info=True;User id=BRAVAUser;Initial Catalog=Brava_1_0_0;Data Source=badgervs1" SelectCommand="ResourceGroupList" SelectCommandType="StoredProcedure" UpdateCommand="ResourceGroupAmend" UpdateCommandType="StoredProcedure" InsertCommand="ResourceGroupAdd" InsertCommandType="StoredProcedure" > <SelectParameters> <asp:Parameter Name="ShowActiveOnly" Type="Boolean" DefaultValue="true"/> </SelectParameters> <UpdateParameters> <asp:Parameter Name="ResourceGroupID" Type="Int32" /> <asp:Parameter Name="ResourceGroupDesc" Type="String" /> <asp:Parameter Name="Active" Type="Boolean" /> </UpdateParameters> <InsertParameters> <asp:Parameter Name="ResourceGroupDesc" Type="String" /> <asp:Parameter Name="Active" Type="Boolean" /> </InsertParameters> </asp:SqlDataSource>
<asp:SqlDataSource runat="server" ID="dsResourceGroupMemberList" ProviderName="System.Data.SqlClient" connectionString="Password=password;Persist Security Info=True;User id=BRAVAUser;Initial Catalog=Brava_1_0_0;Data Source=badgervs1" SelectCommand="ResourceGroupMemberList" SelectCommandType="StoredProcedure" DeleteCommand="ResourceGroupMemberRemove" DeleteCommandType="StoredProcedure" > <DeleteParameters> <asp:Parameter Name="ResourceGroupID" Type="Int32"/> <asp:Parameter Name="ResourceID" Type="Int32"/> </DeleteParameters> </asp:SqlDataSource> <asp:SqlDataSource runat="server" ID="dsResourceGroupMemberUnassignedList" ProviderName="System.Data.SqlClient" SelectCommand="ResourceGroupMemberUnassignedList" SelectCommandType="StoredProcedure"> <SelectParameters> <asp:Parameter Name="ResourceGroupID" Type="Int32"/> </SelectParameters> </asp:SqlDataSource> </div>
</form></body></html>