Values between usercontrols

J

Jacob

I have a problem communicating between two usercontrols.

I have a template.aspx file with two usercontrols:

<uc1:FAQList id="FAQList" runat="server"></uc1:FAQList>
<uc1:FAQCreateQuestion id="FAQCreateQuestion"
runat="server"></uc1:FAQCreateQuestion>


After a postback I want the FAQList usercontrol to make a query,
depending on a selection in a dropdownlist control in the
FAQCreateQuestion usercontrol.
How do I get the selected value from the FAQCreateQuestion usercontrol
to the FAQList usercontrol?
 
S

SSW

Hi,

1) Define a public Property in FAQCreateQuestion user control to get the
value eg. Prop1
2) to get FAQCreateQuestion user control we use as below
FAQCreateQuestion FAQCreateQuestion1
=(FAQCreateQuestion )this.FindControl("FAQCreateQuestion")
3) Call FAQCreateQuestion1.Prop1 to get values of Prop1 of
FAQCreateQuestion1 List box in FAQList.

HTH

Thanks,

sswalia
MCSD, MCAD, OCA
 
J

Jacob Egholm

Hi

Thanx for the quick reply.

I have made the public prop. as below

protected System.Web.UI.WebControls.DropDownList DropDownListControl;

private string prop1;
public string Prop1
{
get
{
prop1 = DropDownListControl.SelectedValue;
return prop1;
}
set
{
prop1 = value;
}
}

But I get a "Object not set to an instance" - error in this line:
prop1 = DropDownListControl.SelectedValue;

I you have any idea what I do wrong it would be great, otherwise thanx
for your help. I am closer to be finish than before your reply:blush:)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top