Showing posts with label webpage. Show all posts
Showing posts with label webpage. Show all posts

Wednesday, March 28, 2012

Update UserControl from another UserControl in an UpdatePanel

I've got 2 usercontrols on my webpage (let's call them uc1 and uc2). In uc1 is a button. When I click on the button I bubble up the event to the main page. In the main page I handle the event. In the event handler on the main page I set a property of uc2 which sets the text of a label in uc2. I want this interaction to happen in an UpdatePanel so that the screen doesn't postback, but I can't seem to get it to work. Any direction would be greatly appreciated. I have a sample app if someone wants to see it.

Hi

I use that technique in nblogr. You can download nblogr's source from codeplex.

Basically you expose a method in your uc2 something like void DoUpdate()
And in that method you call myUpdatePanelID.Update()

and that should do the trick

Hope this helps you a little


Thanks so much! That did the trick!

Could you be a bit more specific? I downloaded that code but there is a lot of code there. Looking for a snippet....

Thanks.

Jeff


What part are you having trouble with? Bubbling up the event from the first control and modifying the second one, or having the UpdatePanel refresh after the changes have occurred?

I was having a similar issue. I've got two controls in two separate panels on one page and I'm using the event bubbling to get the two controls to communicate and toggle their visibility. I was forced to click the first control's button twice before the intended result would take place, even though all the code would execute while debugging. It seemed the first click wasn't updating the client but the second one did. Then I took a closer look at my container page, I didn't have the two controls in an UpdatePanel, even though the container page was setup for ajax. Wrapping the all the controls and panels in an UpdatePanel got it sorted.

Just thought it would be useful to note here.

-jason


Hi, What i have done in my application is like i have a combo inside a usercontrol , another control includes

a login page type controls , Now when ever the user selects any thing from the combo control the text on the login control also changes without full page refresh. If this is your prob. then below is how i did it.

Put your combo control inside UpdatePanel and contentTemplate tag. Dont do any thing with login control just put both of them on aspx page inside a Scriptmanager tag. and on page load of Login control put your logic . If this is not sufficient then i can send you the code .

Can you tell me how to stop the mail of Posts from this site to my mail box, or how to unsubscribe. becoz this thing has filled my personal ID.

Shrikant

updatepanel - Cannot unregister UpdatePanel

Hello everybody!

I have been trying to set programatically visible and unvisible of some Controls in my WebPage. On this Controls there are UpdatePanels.
On each control - one UpdatePanel.

I have a problem. If I try to change visible of UserControl, I get the error "Cannot unregister UpdatePanel ... since was not registered with the Script Manager". OK, I found the solution.
http://msmvps.com/blogs/luisabreu/archive/2006/11/16/adding-removing-updatepanels-dynamicaly-from-a-page.aspx
I have to set visible = true/false in "Page_PreInit" method, it works on single test site, but...

In my project I have a MasterPage, and in method Page_PreInit areference to my control is null, so I can't change visible, and masterpage has no PreInit method.

How to solve it ? Maybe you know some other solution to dynamic hide controls with updatePanel in it.

regards
bakuuu

Can you have the Controls in the UpdatePanel vs the UpdatePanel in the Controls? Seems like this design would work out better...

-Damien


I did it, but these controls are tabs. These tabs look like tabs I see, when I write this replay message (Reply: Compose, Options, Related, Preview). Just imagine, I want to hide some of these tabs.
In this moment I have one big UpdatePanel and all tabs inside. But, I don't like it. There is many controls in each tab (buttons, textBoxes ...) and it weight much. I want to divide these part of page.

bakuuu


Ahh, gotcha.

Well, you could just hide them client-side using the CSSdisplay:none; on the Tab's (not the panel, but the actual tab) outermost <SPAN>. Each tab has an ID assigned to it such as ...TABPANELNAME_tab. You need to just append the "_tab" to the end of the Tab Panel's ID. I have an article ontheming the tab which talks about the tab structure that may help.

-Damien

Saturday, March 24, 2012

Updatepanel and fileupload

hi !

in a webpage i use a fileupload wich is used to upload a xls file, and do some stuff on it and write some text in a label to say if it works

everything works fine

I tried to put the fileupload, button and a trace label in an updatepanel but i got a problem :

when i hit the button and debug the sub i see that the fileupload.hasfile is always False !

can you help me ??

without a full postback you won't be able to send the file to the server.


thanx for the reply, is there no way to use ajax technologie to post the file ?

do you thing it will be possible in the futur ?


Thanx


thanx for the reply, is there a way to use ajax technologie to post the file ?

do you thing it will be possible in the futur ?


Thanx