1

I have an text box where I search in an list, to get the values. Then is shows the name in an list box. Now when I press an button named "Make Changes", I would like the values from the list box to be shows in text boxes, on another webpart. There I then can upate the values.

I have looked on "Connectable Webparts", but i cant make it work. Can somebody maybe help me?

1
  • What webparts are you using? Are they Visual Web Parts or Filter Web Part, XSLTListViewWebPart...? Commented Dec 1, 2012 at 14:45

1 Answer 1

3

To pass values from one webpart to another you need three thing:

1) interface

This is a class that is created in a seprate project. This connects the two webparts together. The interface project impliments the interface class

namespace connectWebparts
{
    public interface passMyValuesInerface
    {
        string stringDataIWantToPass {get;}
        int intDataIWantToPass {get;}
    }
}

2) provider

This is the webpart that you would like to send the data from. The key is to add the interface dll to the project (add reference dll).

namespace connectWebpartsProvider
{
    public class webpartProviderClass : webpart, passMyValuesInerface
    {
    }
}

as you can see above the webpartProviderClass now contains the interface class called passMyValuesInerface.

3) consumer

This is the webpart that will get the values from the provider. You need to do the same as the provider class to get access to the interface class to get the values.

To connect the provider to the consumner you need to add the interface project to the provider and consumer (add reference in both provider and consumer webparts)

once you have built and added the webparts to the gallery and then added them to the page you can connect the two weparts together.

Obviously there are other steps that are missing (no need to recreate the wheel) for the provider and consumer class but its explained in detail in the links below.

For an indepth step by step guide you can follow msdn:

http://msdn.microsoft.com/en-us/library/ms469765(v=office.14).aspx

You can also follow this step by step guide with images ;)

http://www.dotnetcurry.com/ShowArticle.aspx?ID=678

If you still have trouble then post your code in your question and ill be happy to help :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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