Telerik Forums
UI for ASP.NET AJAX Forum
8 answers
272 views
I have a setup where I have a masterpage with a codebehind. I have another page that is a web file with a user control + codebehind that uses the master page. On the masterpage I have a RadAjaxManager that I am creating dynamically in the PageInit and adding to a placeholder on the masterpage:

RadAjaxManager RadAjaxManagerMaster = new RadAjaxManager();
RadAjaxManagerMaster.ID =
"RadAjaxManagerMaster";

AjaxSetting RadAjaxManagerMasterAjaxSettings =
new AjaxSetting();

RadAjaxManagerMasterAjaxSettings.AjaxControlID =
"RadContextMenuMaster"

                AjaxUpdatedControl RadWindowAjaxControl = new AjaxUpdatedControl(); 
                RadWindowAjaxControl.ControlID = "RadWindowMaster";
 
                AjaxUpdatedControl RadContextMenuAjaxControl = new AjaxUpdatedControl(); 
                RadContextMenuAjaxControl.ControlID = "RadContextMenuMaster";
 
                RadAjaxManagerMasterAjaxSettings.UpdatedControls.Add(RadWindowAjaxControl); 
                RadAjaxManagerMasterAjaxSettings.UpdatedControls.Add(RadContextMenuAjaxControl); 
                RadAjaxManagerMaster.AjaxSettings.Add(RadAjaxManagerMasterAjaxSettings); 
 
                RadAjaxLoadingPanel RadAjaxLoadingPanelMaster = new RadAjaxLoadingPanel(); 
                RadAjaxLoadingPanelMaster.ID = "RadAjaxLoadingPanelMaster";
                RadAjaxLoadingPanelMaster.BackgroundPosition = AjaxLoadingPanelBackgroundPosition.Center;
 
                PlaceHolder PlaceHolderCMSAdmin = (PlaceHolder)Shuware.ShuwareCommon.Web.FindControlByID(this.Controls, "PlaceHolderCMSAdmin");
                if (PlaceHolderCMSAdmin != null)
                {
                    PlaceHolderCMSAdmin.Controls.Add(RadAjaxManagerMaster);
                    PlaceHolderCMSAdmin.Controls.Add(RadAjaxLoadingPanelMaster);
                }

Yet when I run the page none of the ajax works at all. I read in another thread that you should create the radajaxmanager in the PageInit and the updated controls in the PageLoad, I tried this as well to no avail. This is inside the PageLoad:

private void CreateAjaxSettings()
    {
        RadAjaxManagerProxy RadAjaxManagerProxy = (RadAjaxManagerProxy)Shuware.ShuwareCommon.Web.FindControlByID(this.Controls, "RadAjaxManagerProxy");
 
        AjaxSetting RadAjaxManagerProxyAjaxSettings = new AjaxSetting();
        RadAjaxManagerProxyAjaxSettings.AjaxControlID = "RadContextMenuMaster";
 
        AjaxUpdatedControl divCMSContentAjaxControl = new AjaxUpdatedControl();
        divCMSContentAjaxControl.ControlID = "divCMSContent";
        divCMSContentAjaxControl.LoadingPanelID = "radAjaxLoadingPanel";
 
        AjaxUpdatedControl RadPlaceholderAjaxControl = new AjaxUpdatedControl();
        RadPlaceholderAjaxControl.ControlID = "PlaceHolderContentCMS";
 
        AjaxUpdatedControl LabelDebugAjaxControl = new AjaxUpdatedControl();
        LabelDebugAjaxControl.ControlID = "LabelDebug";
 
        AjaxUpdatedControl RadWindowAjaxControl = new AjaxUpdatedControl();
        RadWindowAjaxControl.ControlID = "RadWindowMaster";
 
        AjaxUpdatedControl RadContextMenuAjaxControl = new AjaxUpdatedControl();
        RadContextMenuAjaxControl.ControlID = "RadContextMenuCMS";
 
        RadAjaxManagerProxyAjaxSettings.UpdatedControls.Add(divCMSContentAjaxControl);
        RadAjaxManagerProxyAjaxSettings.UpdatedControls.Add(RadPlaceholderAjaxControl);
        RadAjaxManagerProxyAjaxSettings.UpdatedControls.Add(LabelDebugAjaxControl);
        RadAjaxManagerProxyAjaxSettings.UpdatedControls.Add(RadWindowAjaxControl);
        RadAjaxManagerProxyAjaxSettings.UpdatedControls.Add(RadContextMenuAjaxControl);
        RadAjaxManagerProxy.AjaxSettings.Add(RadAjaxManagerProxyAjaxSettings);
    }

And this is in the PageInit: (using a proxy because I have a RadAjaxManager on the masterpage for this file)

            RadAjaxManagerProxy RadAjaxManagerProxy = new RadAjaxManagerProxy();
            RadAjaxManagerProxy.ID = "RadAjaxManagerProxy";
 
            PlaceHolder PlaceHolderCMSAdmin = (PlaceHolder)Shuware.ShuwareCommon.Web.FindControlByID(this.Controls, "PlaceHolderCMSAdmin");
            if (PlaceHolderCMSAdmin != null)
            {
                PlaceHolderCMSAdmin.Controls.Add(RadAjaxManagerProxy);
            }

In both these instances absolutely no ajax works on the page. I used to have these controls on the actual page not in the codebehind and everything worked perfectly.
Dan Miller
Top achievements
Rank 1
 answered on 26 Aug 2010
1 answer
330 views
I have a set of 2 tables I am trying to display in a hierarchical grid. 

Table 1 is a list of State Licenses.  A rep has an identifying "ProducerNumber" and then a "State", which can appear more than once in the table, plus some other details.

Table 2 is a list of State details.  It has the same "ProducerNumber", "State", and then the "Details" line. 

So in my table I want the top level grid to be the list of States, and once a state is expanded the Details lines for that state will be displayed underneath.  The details lines need to match on 3 qualties: "ProducerNumber", "State", and "Class" to be unique.

I've tried setting my table up as per the sample at: http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/declarativerelations/defaultvb.aspx but I only ever get any details for the top level display.  If I click to expand any of the states it's simply blank.

Can anyone help?  Are there more examples of how to set this up?  Do you need to see my code?
Kevin
Top achievements
Rank 1
 answered on 26 Aug 2010
4 answers
156 views

When I push the next page plik on a RadGrid the NeedDataSource event fires.  How do I get the grid to handle paging without hitting the database each time?

<telerik:RadGrid 
        ID="RadGrid1" 
        runat="server" 
        Width="100%" 
        Height="100%" 
        GridLines="None"
        AutoGenerateColumns="False" 
        AllowSorting="True"
        AllowFilteringByColumn="True" 
        SelectedItemStyle-BackColor="LightBlue" AllowPaging="True" 
        onneeddatasource="RadGrid1_NeedDataSource" PageSize="100">
Michael
Top achievements
Rank 1
 answered on 26 Aug 2010
2 answers
110 views
Greetings All,

I am trying to create a MDI (Multiple Document Interface) within an ASP.NET AJAX application using RadMenu and RadWindowManager. I couldn't find anything concerning this topic and wanted to reach out to the community. I have two questions..

1) Is there any documentation about how to achieve this using RadMenu and RadWindowManager? I wasn't able to find any, but don't want to re-invent the wheel if possible.

2) Are there any major flaws with this approach?
            (1) Upon creation of a RadWindow...
                     add a RadMenuItem to the "Window" RadMenuItem using insert() method.
                     mark the item's state as checked.
                     mark all other item's state as unchecked.
            2) Upon selection of a window's RadMenuItem...
                    get the corresponding RadWindow and call window.setActive() on the given window
                    mark the item's state as checked.            
                    mark all other item's state as unchecked.
            3) On window closing...
                     remove the RadMenuItem for the window using remove() method.
                     
Any feedback is much appreciated.

Regards,
Tom
                
    
Tom M
Top achievements
Rank 1
 answered on 26 Aug 2010
2 answers
666 views
Hi, I have a really weird problem.

 I've an aspx page which dynamically loads web user controls into a panel. It loads about 10 user controls, 1 at a time. However, only 3 are causing issues.

FYI, I'm loading the user controls in the onint event as below:

protected override void OnInit(EventArgs e)
        {
            //If we're loading for the first time load default page.
            if (Session["wuc_location"] == null)
           {
               Session["wuc_location"] = "default_wuc.ascx";
               Session["wuc_ID"] = "WUC_default_wuc";
           }
           else
           {
               //Choose which WUC to load based on button clicked!
               switch ((string)Request.Form["__EVENTTARGET"])
               {
                   case "LinkButton_MM_Inbox":
                       Session["wuc_location"] = "administration_wuc.ascx";
                       Session["wuc_ID"] = "WUC_administration_wuc";
                       Session["Page_First_Load"] = true;
                       break;
                   case "LinkButton_MM_System_Logs":
                       Session["wuc_location"] = "logs_main_wuc.ascx";
                       Session["wuc_ID"] = "WUC_logs_main_wuc";
                       Session["Page_First_Load"] = true;
                       break;
                   case "LinkButton_MM_Preferences":
                       Session["wuc_location"] = "user_preferences_wuc.ascx";
                       Session["wuc_ID"] = "WUC_user_preferences_wuc";
                       Session["Page_First_Load"] = true;
                       break;
                   case "LinkButton_P20T":
                       Session["wuc_location"] = "previous_20_transactions_wuc.ascx";
                       Session["wuc_ID"] = "WUC_previous_20_transactions_wuc";
                       Session["Page_First_Load"] = true;
                       break;
                   case "WUC_administration_wuc$LinkButton_ADMIN_SMS_Settings":
                       Session["wuc_location"] = "sms_settings_wuc.ascx";
                       Session["wuc_ID"] = "WUC_sms_settings_wuc";
                       Session["Page_First_Load"] = true;
                       break;
                   case "WUC_administration_wuc$LinkButton_ADMIN_Department_Setup":
                       Session["wuc_location"] = "department_setup_wuc.ascx";
                       Session["wuc_ID"] = "WUC_department_setup_wuc";
                       Session["Page_First_Load"] = true;
                       break;
                   case "WUC_administration_wuc$LinkButton_ADMIN_Terminal_Setup":
                       Session["wuc_location"] = "terminal_setup_wuc.ascx";
                       Session["wuc_ID"] = "WUC_terminal_setup_wuc";
                       Session["Page_First_Load"] = true;
                       break;
                     
                   default:
                       //
                       break;
               }
           }
  
            //Load the selected user control
            Main_PH.Controls.Clear();
            WUC_default_wuc = new Control();
            WUC_default_wuc = this.LoadControl((string)Session["wuc_location"]);
            WUC_default_wuc.ID = (string)Session["wuc_ID"];
            Main_PH.Controls.Add(WUC_default_wuc);
            base.OnInit(e);
        }

I've deleted a lot of "cases" in the switch above to reduce the size of the code.

So below is one of the problems I'm having:

The aspx page has a menu on the left with links such as ADMINISTRATION, SYSTEM LOGS, USER PREFERENCES - If I click on Administration, the wuc_administration.ascx is loaded into Main_PH. I could have another 10 links from within administration.ascx - 1 in particular is the SMS settings page. Clicking on SMS settings loads:

case "WUC_administration_wuc$LinkButton_ADMIN_SMS_Settings":
                       Session["wuc_location"] = "sms_settings_wuc.ascx";
                       Session["wuc_ID"] = "WUC_sms_settings_wuc";
                       Session["Page_First_Load"] = true;
                       break;

Now if I click on the USER PREFERENCES link on the left menu which loads:

case "LinkButton_MM_Preferences":
                       Session["wuc_location"] = "user_preferences_wuc.ascx";
                       Session["wuc_ID"] = "WUC_user_preferences_wuc";
                       Session["Page_First_Load"] = true;
                       break;

I get a view state error:

Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Failed to load viewstate.  The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request.  For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.

Its driving me insane. I understand Viewstate and the way it works... but I don't see how I could be getting viewstate errors when a user control is removed and a new one is added? This error only occurs when traversing from certain user controls. I could go to the email settings control and then to the user preferences control with no problem.....

To make things more interesting I did some debugging.... check out the pictures.

1. - A screen of sms settings (sms.jpg)
2. - A screen of user preferences (user_pref.jpg)
3. - A screen of user preferences after I swap the 2nd dropdown for a label. (user_pref1.jpg)

Screen 3 is the most important. After the user_preferences_wuc.ascx control kept throwing the viewstate error when you click to it from sms_settings_wuc.ascx, I got rid of the 2nd dropdown from user preferences and replaced it with a label:

<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>


When I did this, the result was screen 3. There was no viewstate error but the label got populated with the viewstate from the previous sms_settings_wuc.ascx control..... How is this possible?????? Can somebody shed some light on what is happening??
Sunil
Top achievements
Rank 1
 answered on 26 Aug 2010
4 answers
172 views

Through the eventArgs param in my OnRowSelected function, I'm using eventArgs.getDataKeyValue(columnName) to get the column's value. (After setting that column name in the ClientDataKeyNames property.)

Is it possible to change that column's value in the underlying datatable in the client-side code? Or do I have to call server-side code to change it? Thanks.

Jeremy Yoder
Top achievements
Rank 1
 answered on 26 Aug 2010
6 answers
163 views
I know that I can make a toolbar will the width of a page by simply setting "Width='100%'" but if I have set Orientation="Vertical" how do I get the toolbar to fill the full height of the page? The obvious "Height= '100%'" doesn't work.

-- 
Stuart
Stuart Hemming
Top achievements
Rank 2
 answered on 26 Aug 2010
2 answers
91 views
I have a tree view that is controled client-side.  I want it to be displayed fully expanded when it is initially displayed.  How do I do this?
Michael
Top achievements
Rank 1
 answered on 26 Aug 2010
2 answers
117 views
Hello,

I am trying to implement a solution similar to the one shown in this demo:

http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/clienteditbatchupdates/defaultcs.aspx

In my scenario, the columns are variable. (I am implementing a form to enter index fund monthly returns, and the index funds will grow over time. So each row represents a month ending date and each column represents an index fund. The cell intersection represents the rate of return for an index fund for a period.) I have successfully implemented the edit capability as provided in the example, with modifications due to the fact that the columns defined dynamically. 

Now I need to address the insert issue. Specifically, when the "Add a new row" button is clicked, I need to change the styles of the controls in each cell of the insert row such that the label does not display and the edit controls (all are textboxes) display. I have not yet figured out how to accomplish this. I can trap the ItemCommand "InitInsert" in the code-behind, but what to do then? Any help would be appreciated.

Thanks, Steve
neebs
Top achievements
Rank 2
 answered on 26 Aug 2010
2 answers
102 views
With the Rad Editor for ASP.NET Ajax, the behavior when attempting to delete a root path is different than with the older Rad Editor version we are upgrading from.

In the old version, attempting to delete the root folder displays the message "A root folder may not be deleted".

In the latest version, a confirmation dialog is displayed, just like when deleting any other folder.  When OK is clicked however, the folder is simply not deleted, but no error message is displayed.

I realize I can modify the permission on the root folder to disable the delete button, but this seems like it should be built in.

Thanks. Josh

The following a sample application that will reproduce the issue (note you should have a folder in your web root called images_root).

<%@ Page Language="C#" AutoEventWireup="true" %>
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <telerik:RadEditor ID="RadEditor1" runat="server">
            <ImageManager ViewPaths="~/images_root" UploadPaths="~/images_root" DeletePaths="~/images_root" />
        </telerik:RadEditor>
    </div>
    </form>
</body>
</html>
Joshua
Top achievements
Rank 1
 answered on 26 Aug 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?