locked
How to add custom properties for aspx page ? RRS feed

  • Question

  • User-1727121610 posted

    Hi,

    I am working on VS 2008 shell. In that I have to open aspx page in runtime and that page shoud have few custom properties. So our applicaton designer will design that page in runtime using our custom properties. Meaning that I have to create one aspx page template which should have custom properties. I am able to crate custom control  with custom propertis for button ..the same way I have to create aspx page with custom properties. When user select the page and see the properties window, he should be able to see those custom properties for page also he shoud mask some of the existing page propertis.

    I am not sure for which control we have to create custom propertis. Either document or form. I am not sure how to create custom controls for form, document and all.

    your help is greatly appreciated.

    Raghu

    Monday, April 28, 2008 10:47 AM

Answers

  • User-16411453 posted

    Since you made your control, and it's works in runtime, from what I read, you need to make the control work in design view, so your end user can program the properties of the control.

     
    You have to detect design view and runtime, and in Sub or Void Render, detect and make the switch. Can't help you more because I think you have the wrong forum, and your asking about Server Controls for Windows Applications. I call the pages webforms for web applications.
     

    We make 2 Subs or Voids, 1 for run time and 1 for design view.

    There are tons of posts in this forum on the subject, you should look through them for help.

    0 points? 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, April 30, 2008 7:59 PM

All replies

  • User-764728713 posted

    Hi,

     what you probably want to do is to create your own base class page that other pages can inherit from. You can specify custom properties for the page just as you would for a normal class in the code section. You would be able to reference the custom properties in all your code behind pages. I don't think the designer will update to reflect them - though you probably don't need that anyway since it is quicker to use intellisense and tab-completion when coding using the text interface instead of the GUI.

    If you need help with base classes and inheritance, let us know.
     

    Monday, April 28, 2008 11:46 AM
  • User-1727121610 posted

    Hi, Thanks for your response. but my need is I want to reflect that custom property in the design time also. Because in my application I am using VS Shell 2008 which is used to design the application at runtime. Means my applcation user will be design the form using custom properties of the page at the runtime.

    Tuesday, April 29, 2008 12:37 AM
  • User-16411453 posted

    Since you made your control, and it's works in runtime, from what I read, you need to make the control work in design view, so your end user can program the properties of the control.

     
    You have to detect design view and runtime, and in Sub or Void Render, detect and make the switch. Can't help you more because I think you have the wrong forum, and your asking about Server Controls for Windows Applications. I call the pages webforms for web applications.
     

    We make 2 Subs or Voids, 1 for run time and 1 for design view.

    There are tons of posts in this forum on the subject, you should look through them for help.

    0 points? 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, April 30, 2008 7:59 PM
  • User-1727121610 posted

    I am sorry , I menat web page only not windows form. sorry for using wrong phrase. I am not finding any posts for custom properties for aspx page. I tried pageBase class which will have cusom properties for page. But its refelecting the code  behind file not in design time. I need to accss those aspx page custom properties at the design time itself in properties window as like as other custom server control.Thank you for your attention. I appriciate your help.

    Thank you.

    Raghu

     

     

    Wednesday, May 21, 2008 9:38 AM
  • User-16411453 posted

    Delete the RenderContents(ByVal writer As HtmlTextWriter)

    And use this statement. This is a vb example - it detects design view, and forks the controls load sequence

    Protected Overrides Sub Render(ByVal writer As HtmlTextWriter)

    If Not Me.Context Is Nothing Then
    RenderContents(writer)
    Else
    RenderDesignMode(writer)
    End If

    End Sub

     I use

    • Protected Overrides Sub OnInit(ByVal writer As HtmlTextWriter) for Forms with buttons in run time
    • Protected Overrides Sub CreateChildControls() for just displaying stuff in runtime
    • Private RenderDesignMode(ByVal writer As HtmlTextWriter) for Design View - Just my own Sub I made

    You design your control in RenderDesignMode until you get the look and feel you want. Then copy the code to OnInit or CreateChild. Add Sub OnLoad for your control logic, to populate data.

    In RenderDesignMode, you have to manually render the control using the top level parent object you made.  I use panels as control containers, and place this at the bottom of my code.  panelContainer is my top level object.

    panelContainer.RenderControl(writer)

    This forces the Rendering of the control.

     

    Wednesday, May 21, 2008 1:47 PM