weird user control behaviour - please help!

G

Guest

hi guys

following on from my previous post. ive got this strange error now. my user
control has the following property defined...

private string theSQL;
public string contactSQL
{
get { return theSQL != null ? theSQL : "na"; }#
set { theSQL = value; }
}

then in my ascx.cs page_load (for the control), ive got

contactSQL = "test";

now then, ive got in my aspx page..

protected dartsUC_contactsearch dartsUC_contactsearch1;

if i try

response.write(dartsUC_contactsearch1.contactSQL); from my aspx.cs
page_load, i get "na" on screen.

however, if i try <%= dartsUC_contactsearch1.contactSQL %>, i get "test" on
screen.

It's like the aspx page_load is happening before the ascx page_load,
therefore theres nothing in contactSQL, but when it runs the html inline,
page_loads have finished and all's well. however, I need access to the
contactSQL variable in my codebehind to execute the sql statement.

How can I fix this? any help aprpeciated!

cheers


Dan
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top