Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
430 views
Hello,

I'm running into a strange problem where my use of the client-side AjaxRequest method is causing undesirable content updates on the page.

First, let me explain my scenario, which is rather complex.

I have several User Controls on a portal-styled page.  Each time a User Control is created, I pass a reference of the AjaxManager to the User Control, then I have the User Control add an AjaxSetting to the AjaxManager so that the AjaxManager can trigger an Ajax Request that will update the content in the User Control.

I do not rely on Ajaxified buttons and such to trigger Ajax Requests since I needed to add a little extra control to the process of initiating Ajax Requests.  Instead, via JavaScript setTimeout calls and JavaScript onClick events, I call a centralized JavaScript routine on the main page that calls the AjaxRequest client-side method of the AjaxManager.  (As an aside, I maintain a flag to let me know when there's an active Ajax request, and when there is, any new request to initiate an Ajax Request is queued until the currently running Ajax Request completes.)  This works very nicely.  I can click on a dozen different buttons to trigger independent Ajax Requests.  Each click queues its request, and they all execute in turn.

Here's where things get a little sticky.  When the user clicks a button, I used to disable the button via Javascript before queuing the Ajax request.  Then, when the content of the User Control was updated, the button would automatically return to an enabled status.  I've changed this so that instead of disabling the button, I make a hidden DIV visible, have it overlay the entire contents of the user control (with a slight transparency, and an animating loading GIF.)

Now the problem.  Say I have UC's (User Controls) 1, 2, and 3 all waiting for queued Ajax requests to complete.  If I were to have disabled the buttons, as soon as any one of the Ajax requests completed, the buttons in all three of the UC's got re-enabled.  After changing that to an overlay DIV, the DIV's in each of the UC's returned to their invisible state as soon as the Ajax request for any one of the UC's completed.

It seems to me that the problem is that the AjaxManager is configured to update content in ALL of the UC's.  As such, when an Ajax request completes for any UC, the AjaxManager doesn't know which UC was being updated and it allowed for content in each of the UC's to be refreshed somehow.  (Strange aside... Javascript variables, values stored in HTML controls and the like are not affected.  BUT, the DIV that I changed to visible returns to a hidden state, or the button I disabled returns to an enabled state.) 

Now, to get around this, I added a mechanism that causes the Loading Panels (the DIV's I change to visible) to be "registered" within the Javascript on the page.  Since when any Ajax request ends they all get reset, I trigger a routine that goes through and makes them visible again.  Aside from a brief blink, this works pretty well.

Having gotten to a point I'm pretty happy with how it works, I ran into another problem.  I have a particular UC that has a server-side HTMLTable.  In the processing of the Page_Load event, a routine runs a report that adds rows and cells to the table.  Now, when another UC triggers an Ajax request, upon completion, this particular table returns to a state where it has no data in it.  Effectively, all of the server-side controls that were added after the Page_Init processing (the rows and cells that hold the data), no longer exist and they disappear. 

Now, I borrowed this code from another application, and I can certainly re-write it to build dynamic HTML that I shove into a DIV.  Since I do that elsewhere, I expect that to work ok - I just don't really want to do that.

So, after all that, here are my questions.
  1. What exactly is the AjaxManagerProxy?  I was hoping that perhaps each UC could have an AjaxManagerProxy that would act independently.  I could add the AjaxSettings to the AjaxManagerProxy so that it's set to ONLY affect content in the one UC.  Having read what little I could find on the AjaxManagerProxy, it seems to just transmit the settings and stuff back to the main AjaxManager, so nothing would really change.  I wish the Overview documentation on the RadAjaxManagerProxy explained what its purpose was and how it's designed to be used.
  2. Is there a way, client-side, to tell the AjaxManager to perhaps temporarily NOT update content in some of the controls identified during the process of Adding the AjaxSettings?  For example, on the server, I tell the AjaxManager (via adding AjaxSettings) that it will be updating content in DIV's DIV1, DIV2, and DIV3.  Before making an Ajax Request, however, I would like to tell the AjaxManager that, for this request, we're only updating DIV1.  Next time, I might tell it that we're only updating DIV3.
  3. Not having much faith in 1 and 2, here, I'm thinking of doing this another way.  I could create a hidden button on the UC's that's coded to be the Ajax trigger.  Then, in my JavaScript, rather than calling AjaxRequest, I could call AjaxRequestWithTarget.  Since this would trigger an AjaxRequest as if that button were clicked, and since the button is only supposed to alter content in that DIV, then I wouldn't get the artifacts of other DIV's being updated.  (I tried this before, but I didn't make the button hidden.  Instead, I made it the button that the user clicked.  This resulted in an immediate Ajax Request instead of my being able to handle the queue of requests.  So, I'm saying that I would have two buttons.  One that is visible would do the extra processing I'm asking of it, and call the AjaxManager to initiate the Ajax request.  The second button, which would be hidden and never clicked by the user, would get a simulated click via the AjaxRequestWithTarget, and only the content of that UC would get updated.  Does this have merit?
Thank you very much for reading this rather lengthy post and helping out.
LeBear
Top achievements
Rank 1
 answered on 27 Jan 2008
1 answer
151 views
Hi all,
What is the Prometheus PanelBar equivalent?

I'm building an app that holds an editor and treeview in collapsible panels. Kind of like an accordion. I'd really like to use the recommended Telerik control for the job, but the "older" panelbar looks like the best option at this point.

Is there a Prometheus control that is perfect for the job?

Thanks for any help...
Joe
PureCode
Top achievements
Rank 2
 answered on 26 Jan 2008
1 answer
207 views
One of the columns in my grid is a notes field.  I do not want this column to wrap.  I have set the style > wrap property of the column to false, but it still wraps when the program executes.

Is there something else that I need to set in order to prevent the wrapping of certain fields?

Thank You,

David Nowak.
Fernandes
Top achievements
Rank 1
 answered on 25 Jan 2008
2 answers
250 views

I have a grid that is defined statically, with columns created dynamically.  I followed your documentation on how to do this, creating columns in Page_Load, but when I do that, the columns disappear when sorting.
The grid is ajaxed to update itself via a RadAjaxManager.  If I try to add the columns on Page_Init, i get the following javascript error:

Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Cannot find column LocationName.

NOTE: "LocationName" is a valid name of a field in my datasource.

Here's the full skinny.  I have a page opened in a RadWindow.  That page loads a user control in Page_Load that has my grid.  The user control does some grid setup in Page_Init, then adds the columns in Page_Load (an example of adding a column):

Telerik.Web.UI.GridBoundColumn gridCol = new Telerik.Web.UI.GridBoundColumn();
grid.MasterTableView.Columns.Add(gridCol);
gridCol.HeaderText = "Location";
gridCol.UniqueName = "LocationName";
gridCol.DataField = "LocationName";
if (grid.AllowSorting) gridCol.SortExpression = "LocationName";
gridCol.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
gridCol.ItemStyle.Width = Unit.Percentage(25);
gridCol.HeaderStyle.HorizontalAlign = HorizontalAlign.Left;
gridCol.HeaderStyle.Width = Unit.Percentage(25);

I'm using NeedDataSource.  When I click the "LocationName" column to sort (or any column, for that matter), the entire grid goes away.  If I do the exact same column adding in Page_Init, the javascript error I posted above occurs.  Any help?

Joe
Top achievements
Rank 1
 answered on 25 Jan 2008
4 answers
172 views
First, thanks for all the help so far. I've almost got my treeview working exactly how I imagined. Only one, I hope, challenge remaining...

This is what my treeview looks like (One Root Item)

Home
---About Us
--------Contact Us
---Solutions
---Services
---Etc

Using client-side only, I can drag items between nodes displaying the dotted line (rtDropAbove or rtDropBelow). The problem is that I would like to either "hide" or disable the dotted line when it's above or below Home (Root Node). I've already disabled the drop in-between functionality in that situation, I just need to hide the dotted line.

Is there any way to do this using client-side or CSS?

Here is my code so far. The root node always has a get_value() of 1, which may be the key to my problem.
------------------------
<script type="text/javascript">       
   
    function clientSideEdit(sender, args)
    {
        var destinationNode = args.get_destNode();
        if(destinationNode)
        {
            var firstTreeView = $find('rtv');
            firstTreeView.trackChanges();
            var sourceNodes = args.get_sourceNodes();
            for (var i = 0; i < sourceNodes.length; i++)
            {
                var sourceNode = sourceNodes[i];
                sourceNode.get_parent().get_nodes().remove(sourceNode);
                if(args.get_dropPosition() == "over") destinationNode.get_nodes().add(sourceNode);
                if(args.get_dropPosition() == "above")  insertBefore(destinationNode, sourceNode);
                if(args.get_dropPosition() == "below")  insertAfter(destinationNode, sourceNode);
            }
            destinationNode.set_expanded(true);
            firstTreeView.commitChanges();
        }
    }
   
    function insertBefore(destinationNode, sourceNode)
    {
        var destinationParent = destinationNode.get_parent();
        var index = destinationParent.get_nodes().indexOf(destinationNode);
        destinationParent.get_nodes().insert(index, sourceNode);
    }
   
    function insertAfter(destinationNode, sourceNode)
    {
        var destinationParent = destinationNode.get_parent();
        var index = destinationParent.get_nodes().indexOf(destinationNode);
        destinationParent.get_nodes().insert(index+1, sourceNode);
    }
   
    function onNodeDropping(sender, args)
    {
        var dest = args.get_destNode();
        if (dest)
        {
            if (dest.get_value() != 1 || args.get_dropPosition() == "over")
            {
                clientSideEdit(sender, args);
            }
            args.set_cancel(true);
            return;
        }
    }

  </script>
------------------------

Please let me know if I need to elaborate.
Thanks,
Joe

Joe
Top achievements
Rank 2
 answered on 25 Jan 2008
1 answer
93 views
I have a progress manager and two asp file uploaders, "A" and "B".  I need to set the file name to "a.jpg" if the filename came from uploader "A" and "b.jpg" if it came from uploader "B".  Is there a way to figure out which uploader control a file came from?
George
Telerik team
 answered on 25 Jan 2008
1 answer
125 views
I downloaded RadControls_Prometheus_2007_3_1218_trial.zip, extracted the contents and tried to run ToolBoxInstallerNet20.exe. It came up with an error message box:

ToolBoxInstallers.exe (/install/uninstall)(TargetDir)(ConfigFile)[toolbox tab name]
D:\RadControls\ToolBoxInstallerNet20.exe
[OK]

I click OK and nothing happens??
How do I install the trial?
Paul
Telerik team
 answered on 25 Jan 2008
6 answers
336 views
Does this method:
http://www.telerik.com/support/kb/article/b454K-kdc-b454T-btc.aspx
work for the new editor?
Rumen
Telerik team
 answered on 25 Jan 2008
1 answer
137 views
I know how to create a tool bar within the code behind class. However, I cannot find information how to add a new toolbar on a new line. The on-line help provides code how to create a toolbar with the following code.

EditorToolGroup main = new EditorToolGroup()
RadEditor.Tools.Add(main);

EditorTool spell = new EditorTool();
spell.Name = "AjaxSpellCheck";
spell.ShortCut = "CTRL+S";
main.Tools.Add(spell);

EditorTool print = new EditorTool();
print.Name = "Print";
print.ShortCut = "CTRL+P";
main.Tools.Add(print);

The issue I have is where and how I develop code which will create a new Toolbar under the first one on the Telerik RadEditor server control. For instance, I would like to have the following tool bar under the first one created above:

EditorToolGroup second = new EditorToolGroup()
RadEditor.Tools.Add(second);

EditorTool fontName= new EditorTool();
fontName.Name = "FontName";
fontName.ShortCut = "CTRL+F";
second.Tools.Add(spell);

EditorTool bold= new EditorTool();
bold.Name = "Bold";
bold.ShortCut = "CTRL+B";
second.Tools.Add(print);

In short, am I missing something?
Rumen
Telerik team
 answered on 25 Jan 2008
12 answers
291 views
Hi. I am using a Rad Scheduler with OverflowBehavior set to Scroll and I have set the height to 100%. Also I set the height of html, body and form to 100%.
Everything is ok in IE6 and IE7, but in Firefox I get a scrollbar, the scheduler is just showing the height for the first hour.
OverflowBehavior="Scroll" Height="100%".




Shaun Peet
Top achievements
Rank 2
 answered on 25 Jan 2008
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?