Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Sharepoint
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?
Posted 11-May-13 23:24pm
Kurac1745
Edited 11-May-13 23:25pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 365
1 Sergey Alexandrovich Kryukov 319
2 CPallini 275
3 DamithSL 214
4 Maciej Los 185
0 OriginalGriff 5,455
1 DamithSL 4,457
2 Maciej Los 3,885
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,115


Advertise | Privacy | Mobile
Web02 | 2.8.141216.1 | Last Updated 12 May 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100