Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
215 views
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.
Maria Ilieva
Telerik team
 answered on 01 May 2013
1 answer
145 views
I recently created a custom drop down filter for use in a RadGrid.  I followed the example from these two links:
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/filteringtemplatecolumns/defaultcs.aspx
http://www.telerik.com/help/aspnet/grid/grdfilteringwithdropdownlist.html

The grid shows a list of sites.  The drop down displays a list of statuses that can pertain to requests belonging to the site.  See attached screen shot. The column displays a count showing how many of that site's requests have the selected status. 

The grid has an ExportToExcel button.  When clicking that button, the custom control throws the following exception:
 
2013-04-26 10:01:37.923,0000000F,OPSWeb,Unhandled Application Exception [Page Info: /OPSWeb/OPSMain.aspx],Error,Unable to cast object of type 'Telerik.Web.UI.CompressedPageState' to type 'System.Collections.IDictionary'.
10:21

The error occurs in this method on the last line where it adds the combox to the list of controls in the cell..  

        protected override void SetupFilterControls(TableCell cell)
        {
            rcBox = new RadComboBox();
            rcBox.ID = ID;
            rcBox.AutoPostBack = true;
            rcBox.Width = FilterControlWidth;
            rcBox.SelectedIndexChanged += rcBox_SelectedIndexChanged;
            rcBox.DataSource = StatusList;
            cell.Controls.Add(rcBox);
        }

How do I get the export to work?  Why is this causing the export to fail?

Thank you.
Kostadin
Telerik team
 answered on 01 May 2013
3 answers
238 views
I'm having an issue where on slower servers the loading panel seems to stay visible and keeps spinning while also locking up the rest of the web functionality.

Here's how I reproduce it:
1. Click on folder and let it finish loading contents
2. Click on another folder with a lot of items and before it finishes loading, click back on the first folder.

The loading panel just spins and spins thus making the application useless.

The way it's setup is:
1. Folder Tree is in a Web User Control (.ascx)
2. Clicking a folder in the tree causes the correct grid control, also a Web User Control (.ascx), to load inside of the control with the tree

So 1 .ascx is calling another based on the selected tree node.
Maria Ilieva
Telerik team
 answered on 01 May 2013
1 answer
93 views
Hi,
 Is there a way to raise an event after the RadAjaxManager control finishes processing the response from the server and updates all the controls upon an ajax call?
I have a asp:Hidden field whose value is being set by an ajax call. I want to be able to retrieve the value *after* it is set but there seems to be no way of doing that.
Maria Ilieva
Telerik team
 answered on 01 May 2013
7 answers
298 views
I recently moved the RadAjax control into my master page and now we're noticing a few pages where you previously were able to just hit enter to cause a postback no longer work when Ajax is enabled. Is there some setting to restore the previous behavior or do I have to now write some Javascript code to re-enable this functionality?
Maria Ilieva
Telerik team
 answered on 01 May 2013
3 answers
190 views
Hi team:
    I need some help. I tried to configure the edtior so it will show the html tag in design view in FULL HTML page edit.
same as this page: http://demos.telerik.com/aspnet-ajax/editor/examples/completehtmlsupport/defaultcs.aspx. But the html code always converted in design view. What did I miss?

Cheers
Rumen
Telerik team
 answered on 01 May 2013
4 answers
429 views
Hi All,

I have some controls like textbox,button,combobox inside radwindow.
 I want to read those controls value using javascript.
Please help me in solving this.
Rumen
Telerik team
 answered on 01 May 2013
13 answers
492 views
If you have a combo box on a page that scrolls, it doesn't display properly in chrome. Check out this image I attached to see what I mean.
Ivan Zhekov
Telerik team
 answered on 01 May 2013
3 answers
218 views
Is there an upper limit on how many columns a table may have for it to be successfully exported to CSV or Word format?  I am hitting a bug when my table has 240 columns and I'm trying to export to CSV: this seems like a suspiciously round number but it may be coincidence.  I also hit errors when exporting to Word with far fewer columns, although I am modifying the ExportOutput property quite extensively (to add styling etc.) in this case, so I have presumed the error was a result of my modifications.
Kostadin
Telerik team
 answered on 01 May 2013
1 answer
203 views

How would I got about finding controls in the Insert Item template without using the Item Databound Event? I want to be able to find the controls within a radio button list _SelectedIndexChanged event. I was able to do this with controls inside the EditTemplate:

Protected Sub rblEdit_SelectedIndexChanged(sender As Object, e As EventArgs)
     
       For Each item As GridItem In RadGrid1.MasterTableView.Items
           If item.Edit Then
               Dim editItem As GridEditFormItem = DirectCast(RadGrid1.MasterTableView.GetItems(GridItemType.EditFormItem(item.ItemIndex), GridEditFormItem)
               Dim DDList As DropDownList = DirectCast(editItem.FindControl("ddlEdit"), DropDownList)
               Dim RBLEdit As RadioButtonList = DirectCast(editItem.FindControl("rblEdit"), RadioButtonList)
               Dim bTextBox As TextBox = DirectCast(editItem.FindControl("BTextbox"), TextBox)
               Dim LBLPercent As Label = DirectCast(editItem.FindControl("lblPercent"), Label)
               If RBLEdit.SelectedValue = "No" Then
                   DDList.Visible = False
                   LBLPercent.Visible = False
                   bTextBox.ForeColor = Drawing.Color.DarkRed
               ElseIf RBLEdit.SelectedValue = "Yes" Then
                   bTextBox.ForeColor = Drawing.Color.Green
                   DDList.Visible = True
                   LBLPercent.Visible = True
               End If
 
           End If
 
       Next
 
   End Sub
Jayesh Goyani
Top achievements
Rank 2
 answered on 01 May 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?