Hi,
In my page i am using two <updatepanel>. One of the <updatepanel> is having WHDG. On server side row selectionchagned event of it i want to update the value of label control which is inside Infragistics tab control in another <updatepanel>. Any help on this will appreciate.
Thanks,
Mits
Hello Mitesh,
In order to implement the functionality you described you have to set EnableAjax property of the grid to “false" and set Auto post back flag for Row Selection. Below is markup of grid and label in two different update panels.
<asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate><ig:WebDataGrid ID="WebDataGrid1" runat="server" Height="350px" EnableAjax="false"AutoGenerateColumns="False" Width="627px" DataKeyFields="Cutomer Id" OnRowSelectionChanged="WebHierarchicalDataGrid1_RowSelectionChanged"><Columns><ig:BoundDataField DataFieldName="Cutomer Id" Key="Cutomer Id"><Header Text="Cutomer Id"></Header></ig:BoundDataField><ig:BoundDataField DataFieldName="Address" Key="Address"><Header Text="Address"></Header></ig:BoundDataField></Columns><Behaviors><ig:Selection RowSelectType="Single" Enabled="true" CellSelectType="Multiple" CellClickAction="Row"><AutoPostBackFlags RowSelectionChanged="True" /></ig:Selection></Behaviors></ig:WebDataGrid></ContentTemplate></asp:UpdatePanel>
<asp:UpdatePanel ID="UpdatePanel2" runat="server"><ContentTemplate><asp:Label ID="Label2" runat="server" Text="Label"></asp:Label></ContentTemplate></asp:UpdatePanel>
Below lines of code updates label text based on the cell selected in current row:
protected void WebDataGrid1_RowSelectionChanged(object sender, Infragistics.Web.UI.GridControls.SelectedRowEventArgs e){if (e.CurrentSelectedRows != null){string seltext = e.CurrentSelectedRows[0].Items[0].Text;Label2.Text = seltext;}}
Hope this helps.
Hi Bhadresh,
Thanks for quick reply. The mentioned code is not working in below scenario.
- Expand any row and select a row from child grid. (This works)
- Now without collapsing a first row expand another row and select row from their child grid. This will give an error like index was out of range.
Also is there any way that we can get a datakey of selected row.
Please look into this.