Showing posts with label clicking. Show all posts
Showing posts with label clicking. Show all posts

Wednesday, March 28, 2012

treeview expand depth 2 collapse to depth level 0.

I have treeview on update panel and loading folders based on user interaction. It works for depth level 2 but at this point clicking the node shows depth level 0 results. is there something I am missing?

here are few lines of crap...

Thanks for you help.

<asp:TreeViewid="SourceTreeView"runat="server"Width="100%"OnSelectedNodeChanged="SourceTreeView_SelectedNodeChanged"OnTreeNodeExpanded="SourceTreeView_TreeNodeExpanded"ShowCheckBoxes="Leaf"ImageSet="Simple"Height="100%"ExpandDepth="1"MaxDataBindDepth="10"NodeIndent="15">

<ParentNodeStyleFont-Bold="False"></ParentNodeStyle>

<HoverNodeStyleForeColor="#5555DD"Font-Underline="True"></HoverNodeStyle>

<SelectedNodeStyleHorizontalPadding="0px"ForeColor="#5555DD"VerticalPadding="0px"Font-Underline="True"></SelectedNodeStyle>

<NodeStyleNodeSpacing="0px"HorizontalPadding="0px"ForeColor="Black"VerticalPadding="0px"Font-Size="10pt"Font-Names="Tahoma"></NodeStyle>

</asp:TreeView>

I am adding nodes per users request using following code, which is same for depth 0,1 and 2.

newNode.Expanded =false;

newNode.ShowCheckBox =false;

newNode.PopulateOnDemand =true;newNode.SelectAction =TreeNodeSelectAction.Select;

treeNode.ChildNodes.Add(newNode);

sg20000:

is there something I am missing

You are missing, that the treeview is not supported in the updatepanelTongue Tied

Check here:

UpdatePanel Control Overview


Maybe you are right and thanks for your help.

I found at some places forward slash was being used, i fixed that and while trying to make it work, made some other changes to node before adding to tree and seems like it is working. I think some nodes had / (creating some escape sequences) or something else to trigger wrapping of tree.

is that treeview on update panel will behave unpredictablly or there are some other issues?


sg20000:

is that treeview on update panel will behave unpredictablly or there are some other issues?

I'm also using treeview with updatepanel, regardless is it not supported.

Main issue which I found that the tree state (selected node, expanded/collapsed nodes state etc.) stays out sync when a postback occurs. Especially when you use any client side capability (populate on demand, enableclientscript=true).

For example:

- Treeview in up

- User coll/exp nodes (no postback yet)

- User select a node, partial postback, selectednodechanged handled for example.

- User select a different node, same as before, but coll/exp state messed up.

- etc.

Without client script features it's ok in up, but slow (big complicated markup, big viewstate etc.)

Saturday, March 24, 2012

trigger updatepanel from javascript inside updatepanel

Hello all.

Is it possible to trigger a updatepanel update from a javascript?

I have made an app with a map that I can move around by clicking some imagebuttons on the side or by using the mouse. When I use the buttons (outside the updatepanel) I don't refresh the enitre page, just the map image inside the updatePanel. But when I just the mouse, some javascripts calls the __doPostBack function. This is used to let the mapengine know that it has to make a new map.

Is there a way to make the javascript act like the button that I define with AsyncPostBackTriggers?

Thanks


Endre

Can you simulate the click of the button? This would assume that the button
has already been setup as an AsyncPostBackTrigger.

I'm interested if you can get this to happen just from the client side as I
asked a similar question a while back and was told it wouldn't work.

Wally

wrote in message news:1465688@.forums.asp.net...
> Hello all.
>
>
>
> Is it possible to trigger a updatepanel update from a javascript?
>
> I have made an app with a map that I can move around by clicking some
> imagebuttons on the side or by using the mouse. When I use the buttons
> (outside the updatepanel) I don't refresh the enitre page, just the map
> image inside the updatePanel. But when I just the mouse, some javascripts
> calls the __doPostBack function. This is used to let the mapengine know
> that it has to make a new map.
>
> Is there a way to make the javascript act like the button that I define
> with AsyncPostBackTriggers?
>
> Thanks
>
>
> Endre
>


Listen to the ASP.NET Podcast @.http://www.aspnetpodcast.com/

Not sure if this is applicable to your situation, but I have a page with many UpdatePanel controls and some WebService calls that are done entirely with javascript. There are certain conditions where I call a WebService, and upon it's return in the callback function I want to trigger an UpdatePanel. To do this I put an invisible button inside the UpdatePanel I want to refresh, e.g.,

<asp:Button ID="ReloadActivities" runat="Server" ForeColor="White" BackColor="White" Height="1px" Width="1px" BorderColor="White" BorderStyle="None" OnClick="ReloadActivities_Click" />

In my javascript code I trigger this button using the click method:


function reloadActivities()
{
document.getElementById('<%=ReloadActivities.ClientId%>').click();

}

This works great in IE, but on Firefox it triggers a complete postback (non ajax) and I haven't figured out why yet. And this new firefox bug didn't occur when I was using the June ATLAS release, just after I upgraded to the Ajax Extenstions beta.


I'm doing something similar, but instead of a WebService I'm opening a modal dialog box (only works for IE). Upon it's closure, I use a a javascript function to trigger a linkbutton in my UpdatePanel which refreshes the content.

My problem is that it doesn't seem to work any more using IE 7. Wondering if you've noticed the same?


Try the extender control I build

http://daron.yondem.com


onclick="<%= ClientScript.GetPostBackEventReference(new PostBackOptions(Button1, ""))%>">
Nice solution. However to do it, you need to have a hidden Button1 on your page :) The extender adds it automaticaly, provides JavaScript parameter transfer and its own event handler.

Awesome VR2Big Smile

This means that I can trigger an UpdatePanel from anywhere without messing with the trigger collection. That solves a major headache.