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

  1. #1

    Default custom controls

    Hi all,

    Could someone helps, I have created a custom web control, by creating a dll
    , however when painting the control on the test form it appears ok but when
    running the test form control doesnt appear ??

    Thanks


    Sulafa Malik Guest

  2. Similar Questions and Discussions

    1. communication between an application, custom controls, and user controls
      Hi, and many thanks in advance... I'm a little lost about how to proceed with communication between an application, custom controls, and user...
    2. Why the properties of web user controls which inherted from my custom base UI controls MISSED?
      Why the properties of web user controls which inherted from my custom base UI controls MISSED? How should I to set enable?
    3. Custom controls that contain other controls
      Okay... maybe this has been done. I hate the Microsoft Tab and Multipage controls. So I'm building my own Tabstrip control. The style and DHTML...
    4. ASP.Net custom controls don't appear
      I'm trying to get custom controls to work in Dreamweaver (NOT user controls). We purchased some Infragistics custom controls and I'm trying out...
    5. Accessing Properties of Custom Controls child Controls
      I am using a Custom Control on a page which renders a button control if required. I need to access the child button control's properties (i.e....
  3. #2

    Default custom controls


    I'm a learner of ASP.Net.
    I want to try out a custom control of my own.

    I'm not getting a clear of how to add my own properties to
    the control apart from the common properties like text,
    color, font etc..

    How should I design a html tag with a complete new
    property?

    I need good materials on custom controls.
    Plz help me out.

    thanks in advance,
    vijaya
    vijaya Guest

  4. #3

    Default Re: custom controls

    Hi vijaya,

    You can get a good jumpstart with tutorials offered by sites like
    [url]www.asp.net[/url] and [url]www.gotdotnet.com[/url]


    --
    Victor Garcia Aprea
    Microsoft MVP | ASP.NET
    Looking for insights on ASP.NET? Read my blog:
    [url]http://obies.com/vga/blog.aspx[/url]

    To contact me remove 'NOSPAM'. Please post all questions to the newsgroup
    "vijaya" <anonymous@discussions.microsoft.com> wrote in message
    news:0ccf01c3adcb$70559890$a101280a@phx.gbl...
    >
    > I'm a learner of ASP.Net.
    > I want to try out a custom control of my own.
    >
    > I'm not getting a clear of how to add my own properties to
    > the control apart from the common properties like text,
    > color, font etc..
    >
    > How should I design a html tag with a complete new
    > property?
    >
    > I need good materials on custom controls.
    > Plz help me out.
    >
    > thanks in advance,
    > vijaya

    Victor Garcia Aprea [MVP] Guest

  5. #4

    Default Custom controls

    Hi to all,

    this is my question....

    Webcontrol1
    ________________________
    | |
    |initialize component |
    | button +=new event..... |
    | controls.add(button) |
    | |
    |event onclick |
    | -control.add(webcontrol2) |
    ----------------------------------

    webcontrol2
    _____________________________
    | |
    | InitializeComponent |
    | button2 +=new EventHandler...|
    | -controls.add(textbox) |
    | -controls.add(button2) |
    | Onlclick |
    | Response.write("hello") |
    -----------------------------------------

    The problem its that the webcontrol2 when you cick the button2 and the textbox dissapear from the webcontrol1 and dont show the word "hello"

    thanks in advance
    josema.
    josema Guest

  6. #5

    Default RE: Custom controls

    Hi Josema

    What is happening is that you're creating a child control only in a click event of a button; so if you cause a postback by clicking any other button (or control) than the original button, the code that creates that first button will never execute and will "dissapear"

    --
    Victor Garcia Apre
    Microsoft MVP | ASP.NE
    Looking for insights on ASP.NET? Read my blog
    [url]http://obies.com/vga/blog.asp[/url]
    To contact me remove 'NOSPAM'. Please post all questions to the newsgroup
    Victor Garcia Aprea [MVP] Guest

  7. #6

    Default RE: Custom controls

    How could i solve this??, i have to generate some textboxes dinamically (depends of a number), after the pressing of a button..
    Josema
    Josema Guest

  8. #7

    Default Re: Custom controls

    hi Josema, I had posted a workaround a few weeks ago in this forum. Follow
    up on that post and see if you are able to resolve. I have tested and it
    works nicely. Look at the last post in particular.

    [url]http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=ImVLb.1434%24nC1.287%40news.edisontel.co m&rnum=1&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26q%3DAdd%2Bcontrol%2Bto%2Basp%253APlaceHolder%2 Bon%2Basp.net%2Bpage%2Bfrom%2Buser%2Bcontrol[/url]

    "Josema" <anonymous@discussions.microsoft.com> wrote in message
    news:1CCB4128-6E7F-4466-857F-2D07F52FF1FB@microsoft.com...
    > How could i solve this??, i have to generate some textboxes dinamically
    (depends of a number), after the pressing of a button...
    > Josema

    Alessandro Zifiglio Guest

  9. #8

    Default Re: Custom controls

    Thanks Alessandro, for your fast reply..

    Could i use a placeholder?... cause i have to load a web custom control..

    i cant use this line, cause i dont have a user control...
    c1 = LoadControl("webusercontrol2.ascx"

    Josem

    ----- Alessandro Zifiglio wrote: ----

    hi Josema, I had posted a workaround a few weeks ago in this forum. Follo
    up on that post and see if you are able to resolve. I have tested and i
    works nicely. Look at the last post in particular

    [url]http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=ImVLb.1434%24nC1.287%40news.edisontel.co m&rnum=1&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26q%3DAdd%2Bcontrol%2Bto%2Basp%253APlaceHolder%2 Bon%2Basp.net%2Bpage%2Bfrom%2Buser%2Bcontro[/url]

    "Josema" <anonymous@discussions.microsoft.com> wrote in messag
    news:1CCB4128-6E7F-4466-857F-2D07F52FF1FB@microsoft.com..
    > How could i solve this??, i have to generate some textboxes dinamicall
    (depends of a number), after the pressing of a button..
    > Josem


    Josema Guest

  10. #9

    Default Re: Custom controls

    if its a custom control just add it like you always did. The placeholder and
    usercontrols scenario etc is specific to that particular user who posted his
    problem. All you need to do is use that same logic, that is the viewstate
    and how its being applied in pageload. If you look at the code, when the
    button is being clicked that adds controls to the page, a flag is set in
    viewstate, and you use that same flag in the page_load method to add the
    control if it had already been added. Also move your logic for adding
    controls to the page_load sub and not init, viewstate is available when
    page_load fires ;)

    Let me know if your having difficulty ;P

    "Josema" <anonymous@discussions.microsoft.com> wrote in message
    news:7F24DA0F-0F6A-4BDF-AB16-7E0A90E10996@microsoft.com...
    > Thanks Alessandro, for your fast reply...
    >
    > Could i use a placeholder?... cause i have to load a web custom control...
    >
    > i cant use this line, cause i dont have a user control....
    > c1 = LoadControl("webusercontrol2.ascx")
    >
    > Josema
    >
    > ----- Alessandro Zifiglio wrote: -----
    >
    > hi Josema, I had posted a workaround a few weeks ago in this forum.
    Follow
    > up on that post and see if you are able to resolve. I have tested and
    it
    > works nicely. Look at the last post in particular.
    >
    >
    [url]http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=ImVLb.1434%24nC1.287%40news.edisontel.co m&rnum=1&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26q%3DAdd%2Bcontrol%2Bto%2Basp%253APlaceHolder%2 Bon%2Basp.net%2Bpage%2Bfrom%2Buser%2Bcontrol[/url]
    >
    > "Josema" <anonymous@discussions.microsoft.com> wrote in message
    > news:1CCB4128-6E7F-4466-857F-2D07F52FF1FB@microsoft.com...
    > > How could i solve this??, i have to generate some textboxes
    dinamically
    > (depends of a number), after the pressing of a button...
    > > Josema
    >
    >
    >

    Alessandro Zifiglio Guest

  11. #10

    Default Re: Custom controls


    almost forgot -- use a placeholder if you want your controls to go at a
    specific location on the page.


    "Alessandro Zifiglio" <alessandrozifiglio@NO-SPAM-hotmail.com> wrote in
    message news:eF9Rb.7698$nC1.5757@news.edisontel.com...
    > if its a custom control just add it like you always did. The placeholder
    and
    > usercontrols scenario etc is specific to that particular user who posted
    his
    > problem. All you need to do is use that same logic, that is the viewstate
    > and how its being applied in pageload. If you look at the code, when the
    > button is being clicked that adds controls to the page, a flag is set in
    > viewstate, and you use that same flag in the page_load method to add the
    > control if it had already been added. Also move your logic for adding
    > controls to the page_load sub and not init, viewstate is available when
    > page_load fires ;)
    >
    > Let me know if your having difficulty ;P
    >
    > "Josema" <anonymous@discussions.microsoft.com> wrote in message
    > news:7F24DA0F-0F6A-4BDF-AB16-7E0A90E10996@microsoft.com...
    > > Thanks Alessandro, for your fast reply...
    > >
    > > Could i use a placeholder?... cause i have to load a web custom
    control...
    > >
    > > i cant use this line, cause i dont have a user control....
    > > c1 = LoadControl("webusercontrol2.ascx")
    > >
    > > Josema
    > >
    > > ----- Alessandro Zifiglio wrote: -----
    > >
    > > hi Josema, I had posted a workaround a few weeks ago in this forum.
    > Follow
    > > up on that post and see if you are able to resolve. I have tested
    and
    > it
    > > works nicely. Look at the last post in particular.
    > >
    > >
    >
    [url]http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=ImVLb.1434%24nC1.287%40news.edisontel.co m&rnum=1&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26q%3DAdd%2Bcontrol%2Bto%2Basp%253APlaceHolder%2 Bon%2Basp.net%2Bpage%2Bfrom%2Buser%2Bcontrol[/url]
    > >
    > > "Josema" <anonymous@discussions.microsoft.com> wrote in message
    > > news:1CCB4128-6E7F-4466-857F-2D07F52FF1FB@microsoft.com...
    > > > How could i solve this??, i have to generate some textboxes
    > dinamically
    > > (depends of a number), after the pressing of a button...
    > > > Josema
    > >
    > >
    > >
    >
    >

    Alessandro Zifiglio Guest

  12. #11

    Default Re: Custom controls

    oops, I didnt realize you were adding those controls inside a custom web
    control, i was under the impression that this was all going on in your
    webform. Should still work, however using a placeholder here is useless.
    There is no page_load method too, still you should still be able to use
    viewstate and apply that logic. You might want to use the viewstate in your
    CreateChildControls method, Viewstate is already available to you at this
    time.

    so it is :
    1. when button is clicked add your child controls to your customwebcontrols
    collection.
    2. right after you add the controls, set a flag in viewstate --so after a
    postback you can use this flag to check and see if these child controls had
    been added.
    3. in your createchildcontrols method check for this flag in viewstate and
    if it is set, then call your method that adds your child controls,
    recreating them again after postback.


    "Alessandro Zifiglio" <alessandrozifiglio@NO-SPAM-hotmail.com> wrote in
    message news:gI9Rb.7700$nC1.5499@news.edisontel.com...
    >
    > almost forgot -- use a placeholder if you want your controls to go at a
    > specific location on the page.
    >
    >
    > "Alessandro Zifiglio" <alessandrozifiglio@NO-SPAM-hotmail.com> wrote in
    > message news:eF9Rb.7698$nC1.5757@news.edisontel.com...
    > > if its a custom control just add it like you always did. The placeholder
    > and
    > > usercontrols scenario etc is specific to that particular user who posted
    > his
    > > problem. All you need to do is use that same logic, that is the
    viewstate
    > > and how its being applied in pageload. If you look at the code, when the
    > > button is being clicked that adds controls to the page, a flag is set in
    > > viewstate, and you use that same flag in the page_load method to add the
    > > control if it had already been added. Also move your logic for adding
    > > controls to the page_load sub and not init, viewstate is available when
    > > page_load fires ;)
    > >
    > > Let me know if your having difficulty ;P
    > >
    > > "Josema" <anonymous@discussions.microsoft.com> wrote in message
    > > news:7F24DA0F-0F6A-4BDF-AB16-7E0A90E10996@microsoft.com...
    > > > Thanks Alessandro, for your fast reply...
    > > >
    > > > Could i use a placeholder?... cause i have to load a web custom
    > control...
    > > >
    > > > i cant use this line, cause i dont have a user control....
    > > > c1 = LoadControl("webusercontrol2.ascx")
    > > >
    > > > Josema
    > > >
    > > > ----- Alessandro Zifiglio wrote: -----
    > > >
    > > > hi Josema, I had posted a workaround a few weeks ago in this
    forum.
    > > Follow
    > > > up on that post and see if you are able to resolve. I have tested
    > and
    > > it
    > > > works nicely. Look at the last post in particular.
    > > >
    > > >
    > >
    >
    [url]http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=ImVLb.1434%24nC1.287%40news.edisontel.co m&rnum=1&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26q%3DAdd%2Bcontrol%2Bto%2Basp%253APlaceHolder%2 Bon%2Basp.net%2Bpage%2Bfrom%2Buser%2Bcontrol[/url]
    > > >
    > > > "Josema" <anonymous@discussions.microsoft.com> wrote in message
    > > > news:1CCB4128-6E7F-4466-857F-2D07F52FF1FB@microsoft.com...
    > > > > How could i solve this??, i have to generate some textboxes
    > > dinamically
    > > > (depends of a number), after the pressing of a button...
    > > > > Josema
    > > >
    > > >
    > > >
    > >
    > >
    >
    >

    Alessandro Zifiglio Guest

  13. #12

    Default Re: Custom controls

    You are welcome, josemari.
    Postback if your having difficulty ;)
    "josema" <anonymous@discussions.microsoft.com> wrote in message
    news:6569F5D9-E1F9-449D-BBAD-B3C89EC51B45@microsoft.com...
    > Thanks Alessandro, i will test the instructions that you give me...
    > Thanks for your time, it was very interesting to me, and i see that the
    viewstate can be very useful...
    > Regards.
    > Josema.

    Alessandro Zifiglio Guest

  14. #13

    Default Custom Controls

    Hi
    Iam new to MS .Net technology just getting along with it....I created a custom control ,which takes in a query and displays the data in a tabular format....something similar to a datagrid.

    Since its a custom Control I drag and drop and use it in my Pages. I overload the render method of my Custom Control and I pass the data that is to be displayed.

    Now there is a requisite I have to add a Control ( Say for ex a Dropdown List box)
    Could you please suggest me how do I add a Web-Control dynamically from a Custom -Control.

    And someone could please suggest the difference between
    A web ( server Control and a Custom Control).

    Wannabe_Geek Guest

  15. #14

    Default Re: Custom Controls

    I would say create a public property to your grid control that lets it know
    whether to add your DDL control or not. Add your DDL control in the
    CreateChildControls section of your grid control, based on that property
    value. Does that make sense?

    "Wannabe_Geek" <Wannabe_Geek@discussions.microsoft.com> wrote in message
    news:969559D6-D859-49E6-B89D-805E8D3AAFE0@microsoft.com...
    > Hi
    > Iam new to MS .Net technology just getting along with it....I created a
    custom control ,which takes in a query and displays the data in a tabular
    format....something similar to a datagrid.
    >
    > Since its a custom Control I drag and drop and use it in my Pages. I
    overload the render method of my Custom Control and I pass the data that is
    to be displayed.
    >
    > Now there is a requisite I have to add a Control ( Say for ex a Dropdown
    List box)
    > Could you please suggest me how do I add a Web-Control dynamically from a
    Custom -Control.
    >
    > And someone could please suggest the difference between
    > A web ( server Control and a Custom Control).
    >


    Mike Bell 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