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

I have two webpart right now on selectedindex changed of my textbox(TextboxFirstname) i send textbox data to consumer webpart, the problem is now that i have more then one textbox that i want to send on selectedindexchanged, my TextBoxLastname, i also want to do the same but then TextboxFirstName get also the data that i wrote in textboxlastname, should i use array or something?

This is my Provider here inside i have my textboxes that i want to send to my labels in my consumer, Provider

namespace Cv.Knowit.RegisterYourCv

{ [ToolboxItemAttribute(false)] public class RegisterYourCv : WebPart, IData { // Visual Studio might automatically update this path when you change the Visual Web Part project item. private const string _ascxPath = @"~/_CONTROLTEMPLATES/Cv.Knowit/RegisterYourCv/RegisterYourCvUserControl.ascx";

private Control control;

protected override void CreateChildControls()
{
    control = Page.LoadControl(_ascxPath);
    Controls.Add(control);

}
[ConnectionProvider("Employee")]
public IData GetMyData()
{
    return this;
}

public string Mydata
{
    get { return ((RegisterYourCvUserControl) control).MyData; }
}

} } Consumer

namespace Cv.Knowit.ReallityCv

{ [ToolboxItemAttribute(false)] public class ReallityCv : WebPart { // Visual Studio might automatically update this path when you change the Visual Web Part project item. private const string _ascxPath = @"~/_CONTROLTEMPLATES/Cv.Knowit/ReallityCv/ReallityCvUserControl.ascx";

Control control; private IData provider; protected override void CreateChildControls() { control = Page.LoadControl(_ascxPath); Controls.Add(control); }

protected override void OnPreRender(EventArgs e)
{
    if (provider != null)
    {
        if (!string.IsNullOrEmpty(provider.Mydata))
        {
            ((ReallityCvUserControl)control).MyData(provider.Mydata);
        }
    }
    //base.OnPreRender(e);
}

[ConnectionConsumer("Employee")]
public void ReceiveProvider(IData d)
{
    provider = d;
}

} } My Interface

namespace Cv.Knowit

{ public interface IData { string Mydata { get; } } } My Provider has also

public string MyData { get; set; }

My consumer has also

public void MyData(string cvData)
{
    LabelFirstName.Text = cvData;
    LabelLastName.Text = cvData;

}
My textbofirstname looks like this
protected void TextBoxFirstName_TextChanged(object sender, EventArgs e)
{

        if (TextBoxFirstName.Text != string.Empty)
        {
            MyData = TextBoxFirstName.Text;
        }

}

And my Textboxlastname looks like this

if (TextBoxFirstName.Text != string.Empty)
        {
            MyData = TextBoxLastName.Text;
        }

Right now if i write something only in TextBoxFirstName, the same data get displayed in LabelFirstname And LabelLastName but i want TextboxFirstname in LabelFirstName and TextBoxLastname in LabelLastname, any suggestions?

share|improve this question
    
@ali Sharepoint do u maybe now how i could solve my problem? –  Martin May 12 '13 at 9:09
add comment

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.