Showing posts with label child. Show all posts
Showing posts with label child. Show all posts

Wednesday, March 28, 2012

Treeview acting strange in UpdatePanel

We are having issues with a treeview in an updatepanel with the RC release. When we click a child node, sometimes it closes other nodes at the same level. When a closed node is expanded again, it has a child node that is expanded. It looks like the treeview is mixing up an opened node with one of its child nodes. If we take it out of an update panel, it works fine, but does full postbacks at every click. Any ideas how to fix this problem?

treeview is not supported by Ajax.NET (I heard rumours about Q3 Orcas -related update)

do search in the forum


I have been searching, but didn't find much. It is just yet another ASP.NET control that isn't supported with UpdatePanels since the CTPs...

I would say treeview made troubles even in CTPs...

this control is discussed quite often here, even the post preceding yours mentions that...

http://forums.asp.net/thread/1514853.aspx


It worked fine for us before, and the menu also did. We were also able to use ReportViewers without having to do a full postback, which you have had to since the Betas.

I am really disappointed that Menu and TreeView controls are not supported in ASP.Net AJAX UpdatePanels. I have a production website that successfully uses Menu and TreeView controls in UpdatePanels using the July CTP of Atlas. Sounds like I will never be able to upgrade to the fully supported ASP.Net AJAX version. I know that the TreeView control can do an asynchronous callback for the TreeNodePopulate event, but I also need partial page postbacks for the SelectedNodeChanged event. In fact, I want PopulateNodesFromClient to be false anyway otherwise the atlas UpdateProgress control does not appear for TreeNodePopulate event asynchronous callbacks. And I extensively use Menu controls to create tabstrips in combination with a MultiView control. I hope Menu and Treeview support can still be added to the final version of ASP.Net AJAX.

Remco

Treeview Control How can I trap a callback function

In my web application I have an Ajax Treeview control which populates its child nodes via AJAX, and all is working beautifully except that all our pages turn on a "spinny" image whenever there is a postback either full or partial my problem is how can I trap the completion of the ajax postback so I can turn the spinny off?

I cannot find a treeview event that I can trap on the client side to do this.

I expect someone has ran into this issue before so any help would be gratly appriciated.

I have only recently started using AJAX and so far everything I have seen has been really good but I would to solve this issue.

Cheers

John

How are you populating the tree? What "Ajax Treeview control" are you using?

You should be able to attach a callback handler that will let you get rid of the "spinny", but without knowing your approach I can't recommend how to do this in your instance.

-Damien


Hi Damien

Here is the markup for the treeview I have removed the styling for berevity

<asp:TreeViewID="tvwProcess"runat="server"EnableClientScript="true"OnTreeNodePopulate="GetChildren"PopulateNodesFromClient="true"Style="overflow: auto; height: 490px">

</asp:TreeView>

GetChildren is a serverside method which populates the expanded node

Does this give you enough info?

Thanks

John


You should be able to use the ClientScript.GetCallbackEventReference to get a reference to the callback and then hide the image using the callback method (seehttp://west-wind.com/weblog/posts/2302.aspx for an example).

Hope this helps...

-Damien


Hi Damien

re:

You should be able to use the ClientScript.GetCallbackEventReference to get a reference to the callback and then hide the image using the callback method (seehttp://west-wind.com/weblog/posts/2302.aspx for an example).

I tried your suggestion and got the example from west-wind working fine and also this example from Microsoft http://msdn2.microsoft.com/en-us/library/ms153106.aspx

the problem I still have with the treeview is what event to attach it to. The logical option would be the "OnTreeNodeExpanded" but that looks for a server side methodAm I missing something?CheersJohn

Hi,

At the client side,the"OnTreeNodeExpanded" is the click event of the parent Node.

Monday, March 26, 2012

TreeView Navigation and the Update Control

I am using Master pages, of which I have my Treeview that is used for navigation with a site map, and I have a child page with the FreeTextBox 3.1x on it that is being submitted with a LinkButton. I have all of this wrapped in a Update Panel with an asynchronous trigger on the LinkButton. Here's my problem: I can navigate to other pages using my TreeView navigation just fine if I do not click the LinkButton. If I do, it throws up a JavaScript error saying that Access is Denied. Any ideas?

The Current version des not support TreeView to host in the UpdatePanel. You will ge the complete list of the controls which does not support in update panel in the following link:
http://www.asp.net/AJAX/Documentation/Live/overview/UpdatePanelOverview.aspx Check the Controls that are not compatible section.

Saturday, March 24, 2012

Trigger partial page update from child window... or from DIVed IFrame

Hello there.

I need ideas on how to trigger an update panel from a child window (window.open) with ASP.NET AJAX. How can I access the "parents" page Scriptmanager or even the UpdatePanel itself?

The other possible option would be to do a callback from an IFrame but I am also unsure if it is possible to tweak it in such a way that only certain parts of the page are reloaded.

If you have already accomplished this in some way or the other than I would greatly appreciate if you share your solution or give some hints.


thanks,

Elmar

Gosh, isn′t it always like this - after posting the above I found a very decent solution for this issue. It does not involve hidden controls or similar.

In case you want to know more - here is thelink

Elmar

Wednesday, March 21, 2012

Trouble trying to use PostbackTrigger with FileUpload in UpdatePanel

Scenario: I have 2 UpdatePanels, 1 containing a GridView (master) and the other containing a DetailsView (child). The DetailsView has an AsyncPostBackTrigger for the GridView's SelectedIndexChanged event. I use a CommandField with ShowEditButton in the DetailsView. The DetailsView is in Edit mode by default. One of the fields in the DetailsView contains a FileUpload. In the ItemCreated event, I register the auto generated "Update" LinkButton as a PostBackControl. I have also tried adding a PostBackTrigger to the UpdatePanel, but neither attempt results in the FileUpload.HasFile property being true.

1Protected Sub dv_ItemCreated(ByVal senderAs Object,ByVal eAs System.EventArgs)Handles dv.ItemCreated2Dim linkAs LinkButton =Nothing3 Dim triggerAs PostBackTrigger =Nothing4 If Not dv.FooterRowIs Nothing Then5 Dim commandRowIndexAs Integer = 06Dim commandRowAs DetailsViewRow = dv.Rows(commandRowIndex)7Dim cellAs DataControlFieldCell =CType(commandRow.Controls(0), DataControlFieldCell)8For Each ctlAs ControlIn cell.Controls9If TypeOf ctlIs LinkButtonThen10 link =CType(ctl, LinkButton)11Else : link =Nothing12 End If13 If Not linkIs Nothing Then14 If link.CommandName.Equals("update", StringComparison.CurrentCultureIgnoreCase)Then15'trigger = New PostBackTrigger16 'trigger.ControlID = link.ClientID17 'upDV.Triggers.Add(trigger)18 ScriptManager.GetCurrent(Me).RegisterPostBackControl(CType(link, Control))19End If20 End If21 Next22 End If23 End Sub
The page does do a full postback when the Update button is hit, so at least that works. I'm assuming that HasFile is false for the first Update because the Update button is not registered with the ScriptManager when the page is loaded. After an update, page is loaded with the control registered as a PostBackControl, thus making subsequent updates work fine. Assuming that this is correct, is there anyway to do this? My reasoning in this assumption is that if I select a row in the GridView by default such that when the DetailsView is first loaded into the page, it has a record as opposed to the EmptyDataText being shown, everything works as expected. Is there a way to use this functionality without having a record in DetailsView before the user actually selects a record?

Kind of funny that this works at all. The PostBackTrigger is supposedly not capable of being added programatically based onthe docs.

Ryan Pedersen
MCP


According to the documentation for AJAX the FileUpload control is not supported.

There are several work around available on this forum.