Showing posts with label system. Show all posts
Showing posts with label system. Show all posts

Wednesday, March 28, 2012

TreeView and update panel

I am creating a browser for a large document management system, modelled on the way windows explorer works.

So: ... I have a TreeView providing a view of the folders for which I am populating the child nodes on demand when a node is expanded or clicked. (The original method of populating the whole TreeView was impractical since it took several minutes to return and often timeout!)

At the same time, if a node is clicked, I show a list of the documents in that folder.

I can get this working, but somewhere along the way, the client stops working and the TreeView click event stops firing.

Is this a known issue or do you think I am asking too much of the framework?

I have since abandonded Atlas for this and am currently living with a long blank screen between page refreshes, which I think is totally useless for user experience.

Sorry not an immediate answer, but I would also be interested in anybody else's take on this.

I will trying to build more or less the same thing over the next couple of days (for an online content management system) so I'll get back to you then on it (successful or not!), but no I don't think it's asking too much, it's a perfectly logical use of it!


Coming back to this post.. .

How have you implemented the TreeView - just that it is supposed to implement client call back as part of the control so you shouldn't need to have blank screens and whole page refreshes - possibly a pause before expanding if it's big - but no blank screens?

I've just dropped it into my content management system, and while it's not pure Atlas, it seems to work fine using the client call back? Probably I'm missing something as only just started playing with Atlas.

Saturday, March 24, 2012

Trigger problem

Hello, I have an custom control with an event, Something like this

Partial

Class CustomControl_SearchInherits System.Web.UI.UserControl

End Class

Therein i have declared an event:

PublicEvent SelectedIndexChanged(ByVal senderAsObject,ByVal eAs System.EventArgs)

and in the html i have created an Listbox

<ASP:ListboxSelectionMode="Multiple"ID="_Listbox"runat="server"AutoPostBack="true"Height="100%"Width="400px"/>

then on the event Listbox.selectedIndexChanged i raise the event SelectedIndexChanged.

ProtectedSub Listbox_SelectedIndexChanged(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles _Listbox.SelectedIndexChanged RaiseEvent SelectedIndexChanged(sender, e)EndSubNow when i try to hook up a selectedIndex event (from my custom control) on the TRIGGER property from the update panel, it wont work, Why not?, It doesnt even apear in the event property's of my custom control

Could you specify the control composition?

I mean , whether the update panel holds an instance of your CustomControl_Search, or the ListBox itself.

If it is the first case, it is quite natural that the update panel cannot be triggered by the SelectedIndex event of the list box.

Probably you could paste some more code here ?

Yani


Ok. Here is some more code:

This is the definition of the custom control

<%@.ControlLanguage="VB"AutoEventWireup="false"CodeFile="Search.ascx.vb"Inherits="CustomControl_Search"%>

<tablewidth="100%"height="100%"cellspacing="0"cellpadding="0"border="0"id="TableNav">

<trheight="12px">

<tdrowspan="4"style="width: 400px"class="IL">

<ASP:ListboxSelectionMode="Multiple"ID="_Listbox"runat="server"

Height="100%"Width="400px"/></td>

</tr>

</table>

ProtectedSub Listbox_SelectedIndexChanged(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles _Listbox.SelectedIndexChanged

RaiseEvent SelectedIndexChanged(sender, e)

EndSub

PartialClass CustomControl_Search

Inherits System.Web.UI.UserControl

' declare events

PublicEvent SelectedIndexChanged(ByVal senderAsObject,ByVal eAs system.EventArgs)

PublicEvent Find_Clicked()

' handle event (in customcontrol)

ProtectedSub Listbox_SelectedIndexChanged(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles _Listbox.SelectedIndexChanged

RaiseEvent SelectedIndexChanged(sender, e)

EndSub

EndClass

Then I use this custom contol in an aspx page, with 4 update panels, witch have a trigger on the SelectedIndexChanged event raised by Searchpnl

<tdcolspan="3"><uc4:SearchID="Searchpnl"runat="server/></td>

<cc1:UpdatePanelID="UpdatePanel1"runat="server"RenderMode="Inline">

<ContentTemplate>

-- Content --

</ContentTemplate>

<Triggers><cc1:ControlEventTriggerControlID="Searchpnl"EventName="SelectedIndexChanged"/></Triggers>

</cc1:UpdatePanel>

But I the whole page is updated, and I won't only the update panel to be updated. (that's where its for).

I can't see the SelectedIndexChanged event in the property's. I can't see it in the task pane from the updatepanel either.

Thanks in advance


If you want to get only the update panel updated, you need to put your search control into the update panel.

Other wise it wouldn't know whether to make a regular page post back or an ajax one.

If it does not work try registering your search control in the script manager

ScriptManager1.RegisterAsyncPostBackControl(Searchpnl);

Cheers,

Yani


While we work closely with the ASP.NET AJAX team when developing the Toolkit, they're the real experts on general ASP.NET AJAX issues. Your problem doesn't seem to be directly related to the Toolkit, so we'd appreciate if you considered posting to one of theother newsgroups such asAJAX Discussion and Suggestions. Your post will be more helpful to others looking for similar advice if it's in the right place. Thank you!

hi,

how can an activex control trigger an event of the parent form's control?

for example, I have an activex control which is a button that when clicked, it will output the content of a textbox.

Public Function setText(txt As String)
msg = txt
End Function

Private Sub Button_login_Click()
MsgBox msg

End Sub

After the msgbox is displayed, I want to clear the text in the textbox located in the parent form.

Any idea?

thanks!

Sheila

Wednesday, March 21, 2012

trouble finding a sample using usercontrols and updatepanels

Hi all,

We have created a menu system primairy based on inserting usercontrols inside one single designed page with several areas's. This works very nice for our sites. Of coarse postback occurs on every click or change.

Some functionality inside usercontrols do a lot of postback, so I would be nice to use the update panel for this type of change.

When trying to implement this I ran into all sorts of trouble, so my first step is to hit this forum. From what i find i'm not the only one having some trouble using usercontrols in combination with the update panel.

So question: Does anyone have a working sample which i could have a look at. Probably can't use it 1 on 1 but well it would a nice starting point.

thanks,

-- jan willem

ps. Does anyone notice .. that all the the ajax stuff (including of coarse atlas) looks REAL nice but when u start to implement it it does realy really takes a lot of time learning to program again :-) Well it's new (ehh well kinda), better and customers do love it.

I wrote a sample to have a test with Ajax and User Control.

http://www.box.net/public/static/q4ltbl5an9.zip

It's simple and straight forward:

1. One user control is linkbutton group, auto generated during runtime;

2. Another user control is to display information according to the user control above;

3. Event subscription is used for information delivery.

4. The link which clicked should be set into different style.

Hope it's helpful.

This was researched days before, now I'm running into the problem of Atlas in live.com. It seems doesn't work with EFP at all!


Thanks for the sample it is usefull!

The only trouble is that the atlas controls (scriptmanager, updatepanel) are still created in the page and not in the usercontrol.

I've created a very simplistic sample of what i'm looking for. Just a page and a usercontrol. I put them in the link below.

http://www.bataviagroep.nl/sampleAtlasUC.zip

- default.aspx --> no atlas, just page and usercontrol doing what it should do .. handling click
- atlas-page.aspx --> same as above, all in one page using atlas and working fine (i added the picture so it's very clear that only the notfication changes

- default-atlas.apsx (same as the first default.aspx) but with the atlas inserted in the usercontrol. This one throws the following exeption:

"The UpdatePanel 'UpdatePanel1' was not present when the page's InitComplete event was raised. This is usually caused when an UpdatePanel is placed inside a template."

For those who don't like downloading stuff from a different server:

default.aspx
<body>
<formid="form1"runat="server">
<div>
<asp:PanelID="panel1"runat="server"/>
</div>
</form>
</body
code behind:
ProtectedSub Page_Load(ByVal senderAsObject,ByVal eAs System.EventArgs)HandlesMe.Load

panel1.Controls.Add(Page.LoadControl("~/uc-atlas.ascx"))

EndSub

The usercontrol uc.ascx
<asp:LinkButtonID="LinkButton1"runat="server">click A</asp:LinkButton>
<asp:LinkButtonID="LinkButton2"runat="server">click B</asp:LinkButton>
<br/><br/>
<asp:LabelID="Label1"runat="server"Text="Label">not clicked</asp:Label
code behind:

ProtectedSub LinkButton1_Click(ByVal senderAs System.Object,ByVal eAs System.EventArgs)Handles LinkButton1.Click

Label1.Text ="clicked A"

EndSubProtectedSub LinkButton2_Click(ByVal senderAs System.Object,ByVal eAs System.EventArgs)Handles LinkButton2.Click

Label1.Text =

"clicked B"EndSub

The same user control but then with atlas stuff added:

<atlas:ScriptManagerID="ScriptManager1"runat="server"EnablePartialRendering="true">

</atlas:ScriptManager>

<asp:LinkButtonID="LinkButton1"runat="server">click A</asp:LinkButton>

|

<

asp:LinkButtonID="LinkButton2"runat="server">click B</asp:LinkButton>

<

br/>

<

br/>

<

atlas:UpdatePanelID="UpdatePanel1"runat="server"><ContentTemplate><asp:LabelID="Label1"runat="server"Text="Label">not clicked</asp:Label></ContentTemplate><Triggers><atlas:ControlEventTriggerControlID="LinkButton1"EventName="Click"/><atlas:ControlEventTriggerControlID="LinkButton2"EventName="Click"/></Triggers>

</

atlas:UpdatePanel>

code behind is the same as above.

--> the above doesn't work and throws an expection.

I would love a sample or idea how to fix this

thanks,

-- jan willem

ps. all the code is in the zipfile


load the custom user control in the Page_Init event, it will work then

wow that worked ...

great that was th easy asnwer i kept missing thanks!

--jw


You might try putting a Placeholder control inside the content template of the UpdatePanel, use FindControl() on the UpdatePanel to locate the Placeholder, and use Placeholder.Controls.Add() to add your dynamically created user control from LoadControl().

The key here is that the container for the user control must exist before OnInit(), and the only way to accomplish this is the declaratively put something there first.

I have gotten this scenario to work. Adding anything directly to the UpdatePanel after OnInitComplete() will not work.