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

when viewing detailed table view Radgrid messed up

1 Answer 49 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:26 PM
Hi

I dont know why but all of a sudden RADGRID is behaving weirdly.

When I click to view detail table view, whole radgrid messes up.  All the rows after the detail table view are shown as text merged together without any styling.

However it shows up fine for the first time.have a look at the screen shots.

                    <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!!

1 Answer, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 11 May 2012, 03:51 PM
Rakesh:

This is odd behavior, indeed. I've not seen it before.

A possible cause may be due to the fact that you've set the grid with Visible=false. If you are showing the control after an ajax request, it is possible that some of the styles may not be not registered properly.

If this is the case, you can try to register the RadGrid skin unconditionally with the RadStyleSheetManager.
 
If this fails to solve it, I'd suggest that you open a support ticket with Telerik. Although they monitor the forums and attempt to provide solutions in a timely manner, support tickets are handled as priority and they do their best to guarantee a 24hr reply for these tickets.

I hope this helps!
Tags
Grid
Asked by
Rakesh
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Share this question
or