weird user control behaviour - please help!

Discussion in 'ASP .Net' started by =?Utf-8?B?RGFuIE5hc2g=?=, Nov 2, 2004.

  1. 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
     
    =?Utf-8?B?RGFuIE5hc2g=?=, Nov 2, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. KK
    Replies:
    2
    Views:
    711
    Big Brian
    Oct 14, 2003
  2. dorayme
    Replies:
    1
    Views:
    650
    richard
    Jan 21, 2011
  3. richard
    Replies:
    0
    Views:
    610
    richard
    Jan 21, 2011
  4. richard
    Replies:
    0
    Views:
    641
    richard
    Jan 21, 2011
  5. mastermagrath
    Replies:
    4
    Views:
    480
    robic0
    Dec 1, 2005
Loading...

Share This Page