Click here to Skip to main content
16,019,983 members
Please Sign up or sign in to vote.
4.20/5 (2 votes)
See more:
Hi ,

I have this task to do .

I have a user control that has organization and contact selector rad control . The contact selector has email shown if available. when the contact is selected, i need to show the email in the normal aspx textbox from the contact control. how can i do that? please help by looking at my code as i tried doing like this.
C#
public event Action<string> OnContactChanged;  
   
   #region Page Events
   protected override void OnInit(EventArgs e)
   {
       base.OnInit(e);
       //ContactSelectorV2.OnContactChanged += ContactChanged;
       UserControls_ContactSelectorV2 contact = new UserControls_ContactSelectorV2();
       contact.OnContactChanged += ContactChanged;

   }

OnContactChanged is the event in the usercontrol which i tried to invoke here in the parent page.
when i wrote this method:
C#
public  void ContactChanged()
    {

    }

and my textbox was txtEmail but this was not recognized.

my aspx code is like this for textbox:
ASP.NET
<asp:TextBox ID="txtEmail" runat="server">

I have included the usercontrol like this :
ASP.NET
<uc5:ContactSelectorV2 ID="ContactSelectorV2"  runat="server"/>

for which i have registered in the page like this
HTML
<%@ Register Src="~/UserControls/ContactSelectorV2.ascx" TagName="ContactSelectorV2"    TagPrefix="uc5" %>

Please help asap...
Posted
Updated 5-May-13 1:13am
v2

1 solution

if you're putting all your radio buttons in a group or you're using radioButton List, why don't you use the SelectedIndexChanged event, and inside the event brackets catch the value of selected index and render it on the textbox

C#
protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
{
    TextBox1.Text = RadioButtonList1.SelectedItem.ToString();
}
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900