Getting custom properties on a user control

Ask a Question related to ASP.NET General, Design and Development.

  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. Similar Questions and Discussions

    1. Making Custom Control Properties Visible in Visual Studio's Properties Palette
      I am learning how to use the System.ComponentModel class in VB.NET so that I can add my ASP.NET controls to Visual Studio .NET 2003. I have managed...
    2. Accessing properties in custom control
      Hi all, This is probably a newbie question, but... I have a custom control inherited from System.Web.UI.WebControls.Table. Here is the code: ...
    3. asp.net page not seeing custom control, can't set properties
      I have a asp.net.vb page with a custom control, and for some reason the codebehind is not seeing the control. The control is in a file...
    4. Accessing custom control properties
      Hello, I've created a custom control and want to set properties in the aspx page. <%@ Page language="c#" Codebehind="test_control2.aspx.cs"...
    5. Custom Control - inherit child properties?
      Hey All, I'm building a custom control that contains a System.Web.UI.WebControls.Calendar object and am wondering about how to make the calendar's...
  3. #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.118032567@newssvr21.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

Posting Permissions

  • You may not post new threads
  • You may 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