CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2004
    Posts
    2

    Passing Values between ASPX and ASCX

    I have a page (ASPX) that has a grid on the left side and an embedded web control (ASCX) on the right side. The ascx contains lots of textboxes,labels,etc.

    I have added Get/Set properties for each of the controls in the ascx code-behind file. Here's a snippet of the code;

    ASPX code-behind:

    protected DeficiencyReport DeficiencyRpt1; //reference to ASCX

    DeficiencyRpt1.SPRTextBox= "value"; // set new value


    Property in ASCX:

    public string SPRTextBox {
    get {return SPR.Text;}
    set {SPR.Text=value;}
    }

    Everything works fine except that the value is not displayed in the textbox. Can anybody tell me what I'm missing?

  2. #2
    Join Date
    Sep 2003
    Location
    Argentina....
    Posts
    118

    Re: Passing Values between ASPX and ASCX

    Do you use:
    PHP Code:
    DeficiencyRpt1 = new DeficiencyReport(); 
    My history: QB->VB->TC++->VB->VC++->VC#

  3. #3
    Join Date
    Dec 2004
    Posts
    2

    Re: Passing Values between ASPX and ASCX

    The code is all in C# code-behind

  4. #4
    Join Date
    Sep 2003
    Location
    Argentina....
    Posts
    118

    Re: Passing Values between ASPX and ASCX

    Yes.... but you must instanciate it.... and you forgot to put DeficiencyRpt1 = new DeficiencyReport(); after the declaration....
    My history: QB->VB->TC++->VB->VC++->VC#

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured