This is a migrated thread and some comments may be shown as answers.

[Solved] radgrid filtering and textbox on template column freeze after calling OnTextChanged event

3 Answers 186 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rakesh
Top achievements
Rank 1
Rakesh asked on 09 May 2012, 02:52 PM
Hi,

I am using a asp.net TextBox control inside GridTemplateColumn and OnTextChanged event capuring the text entered by user.
save in memory and bind it back to the RadGrid onItemDataBound.

But after the Grid binds and shows up on screen. I cannot type in textbox control of any row and cannot type in the filter boxes, Radgrid is freezing.

It works after I click the mouse outside the grid and click on filter box or grid template textbox.

                    <telerik:RadGrid ID="rgPhysicalAccessReviewList" runat="server" ShowStatusBar="true" Visible="false"  OnInit="rgPhysicalAccessReviewList_Init"
                    AutoGenerateColumns="False"  AllowSorting="True" AllowMultiRowSelection="False" AllowMultiRowEdit="true" AllowFilteringByColumn="true"
                    OnItemCommand="rgPhysicalAccessReviewList_ItemCommand" OnItemDataBound="rgPhysicalAccessReviewList_ItemDataBound" EnableViewState="true"
                    AllowPaging="true" PageSize="150" OnNeedDataSource="rgPhysicalAccessReviewList_NeedDataSource">
                    <PagerStyle Mode="NumericPages"></PagerStyle>
                    <MasterTableView Width="100%" DataKeyNames="EmployeeID, AccessReviewID" EnableColumnsViewState="true" AllowMultiColumnSorting="True" HeaderStyle-Font-Bold="true" EditMode="EditForms">
                   
                        <NoRecordsTemplate>
                            <div>No records to display</div>
                        </NoRecordsTemplate>
                                    <Columns>
<telerik:GridTemplateColumn AllowFiltering="false" HeaderStyle-HorizontalAlign="Left" HeaderText="Business Manager Comments" HeaderStyle-Width ="300px"  HeaderButtonType="TextButton" UniqueName="CommentsBox">
                                            <ItemTemplate>
                                                     <asp:TextBox ID="txtBxComments" OnTextChanged="txtBxComments_OnTextChanged" Text='<%# Eval("ManagerComments") %>' AutoPostBack="true" runat="server" TextMode="MultiLine" Wrap="True" MaxLength="500" Height="50px" Width="300px"></asp:TextBox>
                                            </ItemTemplate>
                                        </telerik:GridTemplateColumn>   
                                        <telerik:GridTemplateColumn AllowFiltering="false" HeaderStyle-HorizontalAlign="Left" HeaderText="Previous Quarter Comments" HeaderStyle-Width ="300px"  HeaderButtonType="TextButton" UniqueName="PQCommentsBox">
                                            <ItemTemplate>
                                                     <asp:Label ID="lblComments" runat="server"></asp:Label>
                                            </ItemTemplate>
                                        </telerik:GridTemplateColumn>
                      
                                    </Columns>                                   
                    <NestedViewTemplate>
                        <telerik:RadGrid ID="rgEmployeeDetails" AutoGenerateColumns="False" runat="server" AllowPaging="True" BorderWidth="0px" OnNeedDataSource="rgEmployeeDetails_NeedDataSource">
                            <MasterTableView Width="75%" DataKeyNames="EmployeeID" ShowHeader="false" AllowMultiColumnSorting="True" > 
                                    <Columns>
                                            <telerik:GridTemplateColumn HeaderStyle-BorderWidth="0px">
                                                <ItemTemplate>
                                                    <asp:Panel ID="NestedViewPanel" runat="server" CssClass="viewWrap">
                                                        <div class="contactWrap">
                                                            <fieldset style="padding: 10px;">
                                                                <legend style="padding: 5px;"><b>Details of Employee:&nbsp; &nbsp;<%#Eval("LastName")%>,&nbsp;<%#Eval("FirstName")%></b>
                                                                </legend>
                                                                <table>
                                                                    <tbody>
                                                                        <tr>
                                                                            <td>
                                                                                <table class="fontDetails">
                                                                                    <tbody>
                                                                                      <tr>
                                                                                             <td style="font-weight: bold;">
                                                                                                Access Coordinator:
                                                                                            </td>
                                                                                            <td>
                                                                                                <asp:Label ID="Label2" Text='<%#Bind("AccessCoordinator") %>' runat="server"></asp:Label>
                                                                                            </td>
                                                                                            <td style="font-weight: bold;">
                                                                                                AC Phone:
                                                                                            </td>
                                                                                            <td>
                                                                                                <asp:Label ID="Label4" Text='<%#Bind("ACPhone") %>' runat="server"></asp:Label>
                                                                                            </td>
                                                                                        </tr>
<%--                                                                                         <tr>
                                                                                            <td style="font-weight: bold;">
                                                                                                Previous Quarter Comments:
                                                                                            </td>
                                                                                            <td colspan="3">
                                                                                                <asp:Label ID="lblPQComments" Text='<%#Bind("PQComments") %>' runat="server" ></asp:Label>
                                                                                            </td>
                                                                                        </tr>--%>
                                                                                    </tbody>
                                                                                  </table>
                                                                                </td>
                                                                            </tr>
                                                                      </tbody>
                                                                </table>
                                                            </fieldset>
                                                        </div>
                                                    </asp:Panel>
                                                </ItemTemplate>
                                            </telerik:GridTemplateColumn>    
                                    </Columns>                                 
                                </MasterTableView>                          
                        </telerik:RadGrid>
                    </NestedViewTemplate>  
                </MasterTableView>
                <ClientSettings>
                    <Scrolling AllowScroll="true" SaveScrollPosition="true"   UseStaticHeaders = "true" />                   
                </ClientSettings>
                <GroupingSettings CaseSensitive="false" />
                </telerik:RadGrid>

--------------------------------------------------- code behind ---------------------------------------------------

 public void txtBxComments_OnTextChanged(object sender, EventArgs e)
            {
                TextBox txtComments = (TextBox)sender;
                GridDataItem item = (GridDataItem)txtComments.NamingContainer;

                //Remove existing key-value pair if reediting the controls
                if (reviewListChanges.Count > 0)
                {
                    foreach (KeyValuePair<string, string> pair in reviewListChanges)
                    {
                        string[] keyValue = pair.Value.Split('|');
                        if (pair.Key.Equals(item["AccessReviewID"].Text) && keyValue[0].Equals("TextBox"))
                        {
                            reviewListChanges.Remove(pair);
                            break;
                        }
                    }                   
                }

                reviewListChanges.Add(new KeyValuePair<string, string>(item["AccessReviewID"].Text, "TextBox" + "|" + txtComments.Text));
            }

            protected void rgPhysicalAccessReviewList_ItemDataBound(object sender, GridItemEventArgs e)
                {
                  try
                    {

                        if ((e.Item is GridDataItem))
                        {
 if (reviewListChanges.Count > 0)
                            {
                                foreach (KeyValuePair<string, string> pair in reviewListChanges)
                                {
                                    string[] keyValue = pair.Value.Split('|');

                                    if (pair.Key.Equals(gridEditFormItem.OwnerTableView.DataKeyValues[gridEditFormItem.ItemIndex]["AccessReviewID"].ToString()))
                                    {
                                        if (keyValue[0] == "TextBox")
                                        {                                           
                                            txtBx.Text = keyValue[1];                                           
                                        }
                                        else
                                        {                                          
                                            ddlList.SelectedValue = keyValue[1];                                          
                                        }
                                    }
                                }
                            }
                        }
                    }



Please let me know, if any issues.

Appreciate your quick response on this.

3 Answers, 1 is accepted

Sort by
0
Accepted
Tsvetina
Telerik team
answered on 14 May 2012, 03:25 PM
Hi Rakesh,

As I just wrote in your support ticket, I am unable to replicate the problem on my side, using parts of your code. Can you please review the ticket reply and the attached project and post there what are your comments on my replication steps?

Kind regards,
Tsvetina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Ramesh
Top achievements
Rank 1
answered on 29 Apr 2013, 06:24 AM
Hi,

Is the issue resolved? I have a similar issue where in the RadGrid's search textbox on the column filter freezes after 2 attempts on the same column and does not allow the user to change the search or type in other serch textboxes.

Iam using  telerik:RadGrid -> telerik:GridBoundColumn and DataField is set.


This is happening in IE8.

Quick reply on this is highly appreciated.

Thanks & Regards
J. Ramesh

0
Maria Ilieva
Telerik team
answered on 01 May 2013, 10:34 AM
Hello Ramesh,

As my colleague Tsvetina previously mentioned we were not able to replicate similar issue on our side. Could you please open a regular support ticket and send us runnable version of your application which demonstrates the problem you are facing? Thus we will be bale to debug it locally and advise you further.
Also in case you are ajaxifying your RadGrid control with RadAjaxManager or RadAjaxPanel please set RequestQueueSize property for the ajax control to a value grater than 1 and verify if this makes any difference.

Regards,
Maria Ilieva
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Rakesh
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Ramesh
Top achievements
Rank 1
Maria Ilieva
Telerik team
Share this question
or