Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Im embeding two webparts in my sharepoint page using page viewer. One part is UI which takes input from user and on submit it shud be passed to other web part and it should get refreshed. can anyone help with this?

share|improve this question
2  
check this link:- msdn.microsoft.com/en-us/library/ff597538.aspx –  Vishal_Sharepoint Aug 14 '12 at 10:31

2 Answers 2

You can connect two webparts by following link V-B mentioned in comment, however you can also use Ajax Update Panel in one webpart to get your work done but it depends on what your trying to do.

e.g. having 2 update panels selecting something in one panel will produce results in 2nd panel without any postback.

creating-update-panel-in-code-behind-dynamically

or

Ajax Panel in Sharepoint

share|improve this answer

If you want two webparts to talk to each other than you would need to make an Interface class. The interface class connects the consumer and provider class through inheritance.

Its quite easy but if you want to have an ajax updatepanel to performe a partial postback then that is a different ballgame its quite hard to figure out as its a hit or miss with sharepoint 2007 but for 2010 I think they have solved this issue! otherwise if you dont mind a post back than its perfect to share data between two or multiple webparts :)

So you have your interface class that basicly links the provider and consumer class that will inherit from it, once you have done the three seperate webparts or one webpart with three classes you can then connect the two webparts when editing the webpage!

so what you do in one webpart(provider) the other webpart would reflect the changes(consumer).

Here is a small tutorial, once you get your head around whats going on its easy:

http://www.codeproject.com/Articles/37142/Connecting-Custom-Web-Parts-in-SharePoint

EDIT

The interface is a class but its inherits the interface like so ;)

public interface ITextBoxString
{  
    string TextBoxString { get; set; }
}

As you can see this is in a seperate project in its own class that inherits the interface type, the class name is ITextBoxString

so all you need in the provider class is the following to inherit from this class:

public class StringProvider : WebPart, ITextBoxString

As you can see this is another project with a class called StringProvider that inherits from the base class Webpart and it also inherits from the ITextBoxString interface class!

I hope this explains where im comming from, thanks for the correction :)

hope this helps :)

share|improve this answer
    
Interfaces are not classes. Classes implement interfaces. msdn.microsoft.com/en-us/library/ms173156.aspx –  RJ Cuthbertson Aug 14 '12 at 17:00
    
Yes I know that, I mean you create a seperate class for each one (interface, provider and consumer), you have two children classes that inherit from the parent class(interface). They are all seperate webparts in seperate projects within their own classes that you call ;).... I know considering I had to do it a couple of weeks ago for work ;) maybe I need to be more clear with my wording next time. –  ali Sharepoint Aug 14 '12 at 20:26
    
I not implying the Interface that you inherit from is a class ;) just like on winforms inherit from like the base class... I wasnt talking about that if you read through the post youll notice im talking about the class and even state you inherit from the "type" interface in the interface class like so: public interface ICommunicationInterface and in the provider you have the class name then : ICommunicationInterface to inherit from the class you just made and so on.. –  ali Sharepoint Aug 14 '12 at 20:54
    
" you would need to make an Interface class. " I'd clarify that in an edit. Thanks. –  RJ Cuthbertson Aug 14 '12 at 20:56
    
Thanks guys...but 1 more thing i have created webparts by giving url to my html pages(using that page viewer thing given in create webparts).So there are no provider n consumer classes for me. so is der any way to do without classes? –  neal Aug 16 '12 at 6:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.