Professional Web Applications Themes

Getting custom properties on a user control - ASP.NET General

I created a user web control, and here is the line in my ASPX that consumes that control. <joe:RunningSummary CurrentStep=2 id=myRunningSummary runat=server /> The "CurrentStep=2" is supposed to be a "custom property" and I would invoke this user control with different values on various web forms. How do I retrieve the value of "CurrentStep" within the code-behind of the user control?...

  1. #1

    Default Getting custom properties on a user control


    I created a user web control, and here is the line in my ASPX that consumes
    that control.

    <joe:RunningSummary CurrentStep=2 id=myRunningSummary runat=server />


    The "CurrentStep=2" is supposed to be a "custom property" and I would invoke
    this user control with different values on various web forms.


    How do I retrieve the value of "CurrentStep" within the code-behind of the
    user control?



    Boban Dragojlovic Guest

  2. #2

    Default Re: Getting custom properties on a user control

    just as you would any property from any control. assuming that you have
    your property defined in your control something like this

    [Bindable(True), Category("Behavior"), DefaultValue("")]
    Public CurrentStep() As Integer
    {
    get { return ViewState["step"]; }
    set { ViewState["step"] = value; }
    }

    //in page code behind
    protected RunningSummary rs;
    ....
    rs.CurrentStep = 12;


    ~PJ

    "Boban Dragojlovic" <news_N_O_S_P_AM_dragojlovic.org> wrote in message
    news:Et3Ka.1062$j31.118032567newssvr21.news.prodi gy.com...
    >
    > I created a user web control, and here is the line in my ASPX that
    consumes
    > that control.
    >
    > <joe:RunningSummary CurrentStep=2 id=myRunningSummary runat=server />
    >
    >
    > The "CurrentStep=2" is supposed to be a "custom property" and I would
    invoke
    > this user control with different values on various web forms.
    >
    >
    > How do I retrieve the value of "CurrentStep" within the code-behind of the
    > user control?
    >
    >
    >

    PJ Guest

Similar Threads

  1. Making Custom Control Properties Visible in Visual Studio's Properties Palette
    By Nathan Sokalski in forum ASP.NET Building Controls
    Replies: 0
    Last Post: October 17th, 02:05 AM
  2. Accessing properties in custom control
    By Omid in forum ASP.NET Building Controls
    Replies: 0
    Last Post: May 23rd, 04:33 PM
  3. asp.net page not seeing custom control, can't set properties
    By Mad Scientist Jr in forum ASP.NET Building Controls
    Replies: 0
    Last Post: February 17th, 05:06 PM
  4. user control properties not available
    By nic in forum ASP.NET Building Controls
    Replies: 2
    Last Post: January 8th, 11:09 PM
  5. Accessing custom control properties
    By Eric in forum ASP.NET Building Controls
    Replies: 1
    Last Post: October 23rd, 12:44 AM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139