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 {
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 {
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);
}
}
}
[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?