Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
224 views
Hi,,

My aspx page takes quite long to load, so I want to display a loading image during my page is loading. I've found a Ajax sample from your site, but I am getting error..
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="display initial load.aspx.cs" Inherits="loadingImgTest.display_initial_load" %> 
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server">  
    <title></title>  
 
   <script type="text/javascript">  
        window.onload = function()  
        {  
            setTimeout(function() {  
            window[ "<%= RadAjaxManager1.ClientID %>"].AjaxRequest("InitialPageLoad");  
            }, 200);  
        }  
    </script>   
 
 
 
 
</head> 
<body> 
    <form id="form1" runat="server">  
    <telerik:RadScriptManager ID="ScriptManager1" runat="server" /> 
    <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" OnAjaxRequest="RadAjaxManager1_AjaxRequest">  
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="Panel1" LoadingPanelID="AjaxLoadingPanel1" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
        </AjaxSettings> 
      
    </telerik:RadAjaxManager> 
 
           <asp:Panel ID="Panel1" runat="server">  
               <asp:Panel ID="Panel2" Visible="false" runat="server">  
                My content:  
              </asp:Panel> 
           </asp:Panel> 
             
           <telerik:RadAjaxLoadingPanel ID="AjaxLoadingPanel1" runat="server" Height="75px" Width="75px">  
               <asp:Image ID="Image1" runat="server" AlternateText="Loading..." ImageUrl="~/network.PNG"/>  
           </telerik:RadAjaxLoadingPanel>      
    <div> 
      
    </div> 
    </form> 
</body> 
</html> 

here's CS file:
using System;  
using System.Collections.Generic;  
using System.Linq;  
using System.Web;  
using System.Web.UI;  
using System.Web.UI.WebControls;  
 
namespace loadingImgTest  
{  
    public partial class display_initial_load : System.Web.UI.Page  
    {  
        protected void Page_Load(object sender, EventArgs e)  
        {  
 
        }  
 
 
        protected void RadAjaxManager1_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e)  
        {  
            if (e.Argument == "InitialPageLoad")  
            {  
                //simulate longer page load  
                System.Threading.Thread.Sleep(2000);  
                  
                Panel2.Visible = true;  
            }  
        }  
    }  
}  
 
Here's the error message

The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

Could you help?
Thanks..
Johny
Top achievements
Rank 1
 answered on 18 Dec 2009
1 answer
271 views
Hi,

I'm having an issue where I am unable to the Telerik.Web.UI.dll to my GAC and still get our web application to run properly.

When I remove the Telerik dll from the GAC I lose all intellisense functionality on my .aspx pages (.cs pages still have intellisense working fine regardless of GAC) but when I add the dll to my GAC and compile I get the following error at runtime.

Server Error in '/' Application.

Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load file or assembly 'Telerik.Web.UI' or one of its dependencies. The system cannot find the file specified.

Source Error:

[No relevant source lines]

Source File: none    Line: 0

Assembly Load Trace: The following information can be helpful to determine why the assembly 'Telerik.Web.UI' could not be loaded.

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].


Version Information: Microsoft .NET Framework Version:2.0.50727.3082; ASP.NET Version:2.0.50727.3082
Pavlina
Telerik team
 answered on 18 Dec 2009
4 answers
377 views
some of my grid columns contain arabic words. when I export the grid into excel csv file the arabic words exported incorrectly.
what't the problem?
Libertad
Top achievements
Rank 1
 answered on 18 Dec 2009
1 answer
194 views
Hi,
      I am using a RadGrid which has a GridClientSelectColumn. When user selects some rows and does a column reorder, the selected rows become unselected. Why is this happening?  I've set EnableViewState=true.

I've also tried saving the selected rows information in ViewState in the OnColumnsReorder eventhandler. I am retrieving this selected rows information from the ViewState in the Page_Prerender function and setting it. But still selected rows become unselected on columns reorder.

I've attached the aspx page and code behind. Please let me know if I am missing something.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Questions.aspx.cs" Inherits="DiscussionForumTelerikUI.Questions" EnableEventValidation="false" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server">  
<script language="javascript" type="text/javascript" > 
    function RowClick(sender, eventArgs) {  
        <!--alert("Index of clicked row is " + eventArgs.get_itemIndexHierarchical());--> 
        var grid = sender;  
        var MasterTable = grid.get_masterTableView();  
          
        var row = MasterTable.get_dataItems()[eventArgs.get_itemIndexHierarchical()];  
        var idCell = MasterTable.getCellByColumnUniqueName(row, "Id");  
        var tagCell = MasterTable.getCellByColumnUniqueName(row, "TagName");  
        var id = idCell.innerHTML;  
        var tag = tagCell.innerHTML;  
        window.location = "Login.aspx?id=" + id + "&" + "tag=" + tag;  
 
    
    }  
      
    function HandleHeaderContextMenu(sender, eventArgs)  
    {  
        var items = eventArgs.get_menu().findItemByText("Columns").get_items();  
        items._array[0].set_visible(false);  
          
    }  
      
    function GridDestroying(sender, args)  
    {  
          
          
        var theForm = document.forms['form1'];  
        if (!theForm) {  
            theForm = document.form1;  
        }  
 
          
        var grid = sender;  
        var MasterTable = grid.get_masterTableView();  
          
          
        var row = MasterTable.get_dataItems()[0];  
        var idCell = MasterTable.getCellByColumnUniqueName(row, "Id");  
        var tagCell = MasterTable.getCellByColumnUniqueName(row, "TagName");  
        var id = idCell.innerHTML;  
        var tag = tagCell.innerHTML;  
        //__doPostBack(theForm.__EVENTTARGET.value, '');  
        //location.reload(true);  
    }      
      
    function TableDestroying(sender, args)  
    {  
        alert("Table Destroying");  
    }  
      
    function HandlePageEvent(sender, args)  
    {  
        var saveControl = document.getElementById('linkButtonSave');  
        if(saveControl != null)  
        {  
              
            saveControl.removeAttribute("disabled");  
             var theForm = document.forms['form1'];  
        if (!theForm) {  
            theForm = document.form1;  
        }  
        __doPostBack(theForm.__EVENTTARGET.value, '');  
        }  
         
    }  
      
      
</script> 
    <title>Questions</title> 
    <style type="text/css">  
        .container  
        {  
            margin-top: 158px;  
        }  
    </style> 
    </head> 
<body style="background-color: #FFFFFF">  
    <form id="form1" runat="server">  
    <div class="container">  
      
         <div class="logo-container">  
            <img src="images/Logo.jpg" alt="Logo"/>  
         </div> 
         <div class="company-name-container">Stira Technologies</div> 
         <div class="forum-name-container">Technical Discussion Forum</div> 
           
         <div class="go-button-container">   
            <asp:Button Text="Go" runat="server" OnClick="searchButton_Click" ID="searchButton" />   
         </div> 
         <div class="search-textbox-container">  
            <asp:TextBox runat="server" ID="searchTextBox"></asp:TextBox> 
             <br /> 
          </div> 
          <div class="search-text-container">Search</div> 
          <div class="link-button-container">  
             <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/AddQuestion.aspx">Ask Question</asp:HyperLink> 
              <br /> 
         </div> 
         <div class="welcome-message-container">Welcome</div> 
       </div> 
       <div class="span-24">  
            <br /> 
            <telerik:RadGrid ID="questionsRadGrid" runat="server" AllowPaging="True"   
                AllowSorting="True" GridLines="None" Skin="Telerik" PageSize="20"   
                Font-Names="Calibri" Font-Size="Large"   
                     OnDetailTableDataBind="questionsRadGrid_DetailTableDataBind"   
                     OnNeedDataSource="questionsRadGrid_NeedDataSource" EnableViewState="true" OnColumnsReorder="questionsRadGrid_ColumnsReordered">   
                     
            <MasterTableView> 
            <RowIndicatorColumn> 
            <HeaderStyle Width="20px"></HeaderStyle> 
            </RowIndicatorColumn> 
 
            <ExpandCollapseColumn> 
            <HeaderStyle Width="20px"></HeaderStyle> 
            </ExpandCollapseColumn> 
            </MasterTableView> 
 
                   <ClientSettings AllowColumnsReorder="True">  
                    <ClientEvents OnRowClick="RowClick" OnHeaderMenuShowing="HandleHeaderContextMenu"/>  
                      
                        <Selecting AllowRowSelect="True" /> 
                          
                    </ClientSettings> 
                      
                </telerik:RadGrid> 
      
      </div>     
      
     
      
    <%--<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
            <AjaxSettings> 
                <telerik:AjaxSetting AjaxControlID="questionsRadGrid">  
                    <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="questionsRadGrid" /> 
                    </UpdatedControls> 
                </telerik:AjaxSetting> 
            </AjaxSettings> 
        </telerik:RadAjaxManager>--%> 
 
            <telerik:RadScriptManager ID="RadScriptManager1" Runat="server">  
            </telerik:RadScriptManager> 
 
    </form> 
</body> 
</html> 
using System;  
using System.Collections.Generic;  
using System.Collections;  
using System.Linq;  
using System.Web;  
using System.Web.UI;  
using System.Web.UI.WebControls;  
using System.ServiceModel.Web;  
using System.ServiceModel;  
using Microsoft.ServiceModel.Web;  
using Microsoft.Http;  
using Microsoft.Http.Headers;  
using System.Xml.Serialization;  
using System.Runtime.Serialization.Json;  
using DiscussionForum.Library;  
using Telerik.Web.UI;  
 
namespace DiscussionForumTelerikUI  
{  
    public partial class Questions : System.Web.UI.Page  
    {  
 
 
        protected void Page_Load(object sender, EventArgs e)  
        {  
            if (!Page.IsPostBack)  
            {  
 
 
                questionsRadGrid.AutoGenerateColumns = false;  
 
                questionsRadGrid.MasterTableView.DataKeyNames = new string[] { "Id""TagName" };  
 
                questionsRadGrid.MasterTableView.EnableHeaderContextMenu = true;  
 
                questionsRadGrid.AllowMultiRowSelection = true;  
                questionsRadGrid.ClientSettings.Selecting.AllowRowSelect = true;  
 
 
                GridClientSelectColumn selectColumn = new GridClientSelectColumn();  
                questionsRadGrid.MasterTableView.Columns.Add(selectColumn);  
                selectColumn.Visible = true;  
                selectColumn.UniqueName = "Select";  
 
                GridBoundColumn subjectColumn = new GridBoundColumn();  
                questionsRadGrid.MasterTableView.Columns.Add(subjectColumn);  
                subjectColumn.DataField = "Subject";  
                subjectColumn.HeaderText = "Subject";  
                subjectColumn.UniqueName = "Subject";  
 
                GridBoundColumn descriptionColumn = new GridBoundColumn();  
                questionsRadGrid.MasterTableView.Columns.Add(descriptionColumn);  
                descriptionColumn.DataField = "Description";  
                descriptionColumn.HeaderText = "Description";  
                descriptionColumn.UniqueName = "Description";  
 
                GridBoundColumn createDateTimeColumn = new GridBoundColumn();  
                questionsRadGrid.MasterTableView.Columns.Add(createDateTimeColumn);  
                createDateTimeColumn.DataField = "CreateDateTime";  
                createDateTimeColumn.HeaderText = "Created Date Time";  
                createDateTimeColumn.UniqueName = "CreateDateTime";  
 
                GridBoundColumn userNameColumn = new GridBoundColumn();  
                questionsRadGrid.MasterTableView.Columns.Add(userNameColumn);  
                userNameColumn.DataField = "UserName";  
                userNameColumn.HeaderText = "User Name";  
                userNameColumn.UniqueName = "UserName";  
 
 
                GridBoundColumn tagNameColumn = new GridBoundColumn();  
                questionsRadGrid.MasterTableView.Columns.Add(tagNameColumn);  
                tagNameColumn.DataField = "TagName";  
                tagNameColumn.HeaderText = "Tag Name";  
                tagNameColumn.UniqueName = "TagName";  
 
 
                GridBoundColumn idColumn = new GridBoundColumn();  
                questionsRadGrid.MasterTableView.Columns.Add(idColumn);  
                idColumn.DataField = "Id";  
                idColumn.HeaderText = "Id";  
                idColumn.UniqueName = "Id";  
 
                //Create the detail table  
                GridTableView gridTableView = new GridTableView(questionsRadGrid);  
 
                questionsRadGrid.MasterTableView.DetailTables.Add(gridTableView);  
 
                GridRelationFields gridRelationFields = new GridRelationFields();  
                gridTableView.ParentTableRelation.Add(gridRelationFields);  
                gridRelationFields.MasterKeyField = "Id";  
                gridRelationFields.DetailKeyField = "QuestionId";  
 
                gridTableView.AutoGenerateColumns = false;  
                gridTableView.Width = Unit.Percentage(100);  
 
                GridBoundColumn answerColumn = new GridBoundColumn();  
                gridTableView.Columns.Add(answerColumn);  
                answerColumn.DataField = "Description";  
                answerColumn.HeaderText = "Answer";  
                answerColumn.UniqueName = "Answer";  
 
                GridBoundColumn userNameColumn1 = new GridBoundColumn();  
                gridTableView.Columns.Add(userNameColumn1);  
                userNameColumn1.DataField = "UserName";  
                userNameColumn1.HeaderText = "User Name";  
                userNameColumn1.UniqueName = "UserName";  
 
                GridBoundColumn tagColumn = new GridBoundColumn();  
                gridTableView.Columns.Add(tagColumn);  
                tagColumn.DataField = "TagName";  
                tagColumn.HeaderText = "Tag Name";  
                tagColumn.UniqueName = "TagName";  
                tagColumn.Visible = false;  
 
                GridBoundColumn createdDateTimeColumn = new GridBoundColumn();  
                gridTableView.Columns.Add(createdDateTimeColumn);  
                createdDateTimeColumn.DataField = "CreatedDateTime";  
                createdDateTimeColumn.HeaderText = "Created DateTime";  
                createdDateTimeColumn.UniqueName = "CreatedDateTime";  
 
 
                GridBoundColumn questionIdColumn = new GridBoundColumn();  
                gridTableView.Columns.Add(questionIdColumn);  
                questionIdColumn.DataField = "QuestionId";  
                questionIdColumn.HeaderText = "Question Id";  
                questionIdColumn.UniqueName = "QuestionId";  
                questionIdColumn.Visible = false;  
 
            }  
 
 
 
        }  
 
        protected void Page_Prerender(object sender, EventArgs e)  
        {  
            ArrayList selectedItemsList = (ArrayList)ViewState["Selected Rows"];  
 
            if (selectedItemsList != null)  
            {  
                foreach (GridDataItem item in questionsRadGrid.MasterTableView.Items)  
                {  
                    if (selectedItemsList.Contains(item["Id"].Text))  
                    {  
                        item.Selected = true;  
                    }  
                }  
            }  
        }  
        protected void exportButton_Click(object sender, EventArgs e)  
        {  
            questionsRadGrid.ExportSettings.OpenInNewWindow = true;  
            questionsRadGrid.ExportSettings.FileName = "Export";  
            questionsRadGrid.MasterTableView.ExportToExcel();  
        }  
 
        protected void questionsRadGrid_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)  
        {  
            if (!e.IsFromDetailTable)  
            {  
                HttpClient client = new HttpClient();  
                HttpResponseMessage response = client.Get(new Uri("http://localhost/QuestionService/Service.svc/"));  
                response.Content.LoadIntoBuffer();  
 
                QuestionCollection questionCollection = response.Content.ReadAsXmlSerializable<QuestionCollection>();  
                questionsRadGrid.DataSource = questionCollection;  
 
            }  
        }  
 
 
        protected void questionsRadGrid_DetailTableDataBind(object source, Telerik.Web.UI.GridDetailTableDataBindEventArgs e)  
        {  
            GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem;  
 
            string questionId = dataItem.GetDataKeyValue("Id").ToString();  
            string tagName = dataItem.GetDataKeyValue("TagName").ToString();  
 
            HttpClient client1 = new HttpClient();  
            HttpResponseMessage response1 = client1.Get(new Uri("http://localhost/AnswerService/Service.svc/" + questionId));  
            response1.Content.LoadIntoBuffer();  
 
            AnswerCollection answerCollection = response1.Content.ReadAsXmlSerializable<AnswerCollection>();  
 
            foreach (Answer answer in answerCollection)  
            {  
                answer.TagName = tagName;  
                answer.QuestionId = questionId;  
            }  
 
 
            e.DetailTableView.DataSource = answerCollection;  
 
 
        }  
 
        protected void searchButton_Click(object sender, EventArgs e)  
        {  
            Response.Redirect("SearchResults.aspx?q=" + searchTextBox.Text);  
        }  
 
        protected void questionsRadGrid_ColumnsReordered(object sender, GridColumnsReorderEventArgs e)  
        {  
            ArrayList gridSelectedItemsList = new ArrayList();  
 
 
            foreach (GridDataItem item in questionsRadGrid.MasterTableView.Items)  
            {  
                if (item.Selected)  
                {  
                    gridSelectedItemsList.Add(item["Id"].Text);  
                }  
 
            }  
 
            ViewState["Selected Rows"] = gridSelectedItemsList;  
        }  
 
    }  
}  
 

Thanks
Satyaprakash J
Pavlina
Telerik team
 answered on 18 Dec 2009
1 answer
111 views
Hi

Can I style the selected row as in Windows 7's explorer with a background ower the hole row in RadTreeView? (See attach)

// Patric
Kamen Bundev
Telerik team
 answered on 18 Dec 2009
1 answer
111 views

My users are trying to create an ordered list and then selecting the ordered list and bolding the whole list.  They are expecting the numberings (1., 2., 3.) to be bold as well and are surprised when they are not.  Is this a bug with how the editor deals with bold and ordered lists?  Or is this by design?

E.g.:

my list:
  1. a
  2. b
  3. c

notice how 1., 2., and 3. are not bold but a, b, and c are

Martin
Telerik team
 answered on 18 Dec 2009
1 answer
148 views
I have a hierarchy RadGrid with a master and one detail.  I'm declaring my dataSources with SQLDataSource.  The master shows a column summing up the detail dollar amounts.

The binding works great on initial load and if I manually click refresh on the detail. 

I can't seem to figure out how to get the master to auto-refresh (rebind) after a detail record is added, deleted or updated.

Please help.

Thanks,
Scott
Princy
Top achievements
Rank 2
 answered on 18 Dec 2009
1 answer
124 views
Binding the radcomboboxes in the edit item template in radgrid detail table view,where two radcomboboxes has relation.and they had to be selected when we  click edit.

Example:

I have two radcombobboxes in two  Different  EditItem Templates's in radgrid detail table view ,one radcombobox consists of country's and based on the selection of the country another rad combobox is get databinded with city.

While inserting there is no problem,but when i click edit the radcomboboxes are not been selected with there selected values
Yavor
Telerik team
 answered on 18 Dec 2009
2 answers
162 views
Hi,

In the RadEditor, I used Image Manager to upload an image and then added it to the Editor. But if I move the image to a new position, the relative url image path get rewritten to the absolute url (<IMG alt="" src="/MyProject/content/Images/$2_Bill_Concert.jpg"> ===> <IMG alt="" src="http://localhost/MyProject/content/Images/$2_Bill_Concert.jpg"> ). I tried using "

HtmlContent.ContentFilters =

EditorFilters.None;" and also 

 

"StripAbsoluteImagesPaths

 

="true". None of those seemed work. Is there any other way to fix this. I want the image url to stay relative.

Thanks in adavnce for your help.
AM

 

Fit2Page
Top achievements
Rank 2
Bronze
Iron
Iron
 answered on 18 Dec 2009
1 answer
127 views
Is it possible to have multiple columns in a griddropdowncolumn combobox like the combobox control can?
Princy
Top achievements
Rank 2
 answered on 18 Dec 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?