Hi,
I am trying to update a text field when the WebGrid.OnRowFilterApplied method is fired. Here is a code snippet of what I am trying to do.
On the client:
<asp:TextBox ID="txtBox" runat="server" Width="80%" Height="56px" />
<igtbl:UltraWebGrid ID="UltraGrid" runat="server" Browser="Xml" Height="216px"Width="767px" OnInitializeLayout="UltraGrid_InitializeLayout" OnInitializeDataSource="UltraGrid_InitializeDataSource"OnRowFilterApplied="UltraGrid_OnRowFilterApplied"DataSource="<%# dataSource %>" DataMember="DataMember"><Bands></Bands>
<DisplayLayout AllowAddNewDefault="Yes" AllowColSizingDefault="Free" AllowUpdateDefault="Yes"AllowSortingDefault="OnClient" LoadOnDemand="Xml" RowsRange="20" BorderCollapseDefault="Separate"ColWidthDefault="200px" HeaderClickActionDefault="SortMulti" Name="UltraWebGrid1"RowHeightDefault="20px" RowSelectorsDefault="No" RowSizingDefault="Free" SelectTypeRowDefault="Extended"StationaryMargins="Header" TableLayout="Fixed" UseFixedHeaders="True" Version="4.00">... ... <FilterOptionsDefault AllowRowFiltering="OnClient"> <FilterDropDownStyle BackColor="White" BorderColor="Silver" BorderStyle="Solid" BorderWidth="1px" CustomRules="overflow:auto;" Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="11px" Width="200px"> <Padding Left="2px" /> </FilterDropDownStyle> <FilterHighlightRowStyle BackColor="#151C55" ForeColor="White"> </FilterHighlightRowStyle> </FilterOptionsDefault> </DisplayLayout></igtbl:UltraWebGrid>
On the server
protected void UltraGrid_OnRowFilterApplied(object sender, Infragistics.WebUI.UltraWebGrid.FilterEventArgs e) { txtBox.Text = "Some value"; }
I cannot set the value in the textbox from within the OnRowFilterApplied. When I try it using a normal WebGrid without the LoadOnDemand="Xml" , the code works fine. Since my Datasource is very large I need to use the lazy loading functionality provided by UltraWebGrid.
Can anyone please advice me of a way around this problem?
Thanks in Advance.
Since this only occurs when you have the grid's AJAX enabled (LoadOnDemand = Xml), this is expected behavior. This is because, when the grid does an AJAX callback, it sends only enough information to perform the required function; likewise, when the server sends its AJAX response, it sends only enough information for the grid to update itself. As a result, other controls (such as your TextBox) are not updated on the client when their value is changed on the server.
The best solution I can find to get around this is to place your TextBox in a WebAsyncRefreshPanel (WARP) or UpdatePanel, and refresh that panel when the grid processes an AJAX response (using client-side events, either XmlHTTPResponse or AfterXmlHttpResponseProcessed).