what is best approach doing this?

Discussion in 'ASP .Net' started by Jeff, Oct 14, 2006.

  1. Jeff

    Jeff Guest

    Hey

    ASP.NET 2.0

    I'm about to create a UserControl for my web project, but I'm wondering if I
    need to create 2 UserControls instead. Because these UserControls will be
    very similar, the only difference between them will be that one of these
    UserControls are containing a control (also being a UserControl, lets call
    it "A"), which the other UserControl don't contain!

    So I thought about creating 2 different UserControls... but I guess this
    would be bad, because these 2 UserControls will have the same markup, except
    one the UserControls have a control ("A", mention above) which the other
    userControl don't have

    Or I could instead create only 1 UserControl, have have some logic in it
    which hide or show the control ("A"). In this way I could use only
    UserControl and use some kind of logic to hide or show this extra control
    ("A")... I guess this approach is the best, but would like to know your
    thought about this too?

    Best Regards

    Jeff
     
    Jeff, Oct 14, 2006
    #1
    1. Advertising

  2. Jeff

    Siva M Guest

    I prefer the second approach because it is easy to make changes later at one
    place instead of two.

    "Jeff" <> wrote in message
    news:...
    Hey

    ASP.NET 2.0

    I'm about to create a UserControl for my web project, but I'm wondering if I
    need to create 2 UserControls instead. Because these UserControls will be
    very similar, the only difference between them will be that one of these
    UserControls are containing a control (also being a UserControl, lets call
    it "A"), which the other UserControl don't contain!

    So I thought about creating 2 different UserControls... but I guess this
    would be bad, because these 2 UserControls will have the same markup, except
    one the UserControls have a control ("A", mention above) which the other
    userControl don't have

    Or I could instead create only 1 UserControl, have have some logic in it
    which hide or show the control ("A"). In this way I could use only
    UserControl and use some kind of logic to hide or show this extra control
    ("A")... I guess this approach is the best, but would like to know your
    thought about this too?

    Best Regards

    Jeff
     
    Siva M, Oct 14, 2006
    #2
    1. Advertising

  3. Jeff

    Jeff Guest

    I agree on that but if I hide the control, will the UserControl display
    still reserve space for the hided control?

    In other words this control I want to hide/show is (400 pixels height and
    witdth=100%) placed at the top of the UserControl. If this control is hidden
    will the UserControl still reserve space (400 pixels height and witdth=100%)
    for the hidden control??....

    and in what event should I hide/show the control?

    Jeff


    "Siva M" <> wrote in message
    news:ORHQ%...
    >I prefer the second approach because it is easy to make changes later at
    >one
    > place instead of two.
    >
    > "Jeff" <> wrote in message
    > news:...
    > Hey
    >
    > ASP.NET 2.0
    >
    > I'm about to create a UserControl for my web project, but I'm wondering if
    > I
    > need to create 2 UserControls instead. Because these UserControls will be
    > very similar, the only difference between them will be that one of these
    > UserControls are containing a control (also being a UserControl, lets call
    > it "A"), which the other UserControl don't contain!
    >
    > So I thought about creating 2 different UserControls... but I guess this
    > would be bad, because these 2 UserControls will have the same markup,
    > except
    > one the UserControls have a control ("A", mention above) which the other
    > userControl don't have
    >
    > Or I could instead create only 1 UserControl, have have some logic in it
    > which hide or show the control ("A"). In this way I could use only
    > UserControl and use some kind of logic to hide or show this extra control
    > ("A")... I guess this approach is the best, but would like to know your
    > thought about this too?
    >
    > Best Regards
    >
    > Jeff
    >
    >
     
    Jeff, Oct 14, 2006
    #3
  4. Jeff

    Siva M Guest

    Set the Visible property to False. This wil not generate any markup nor will
    it occupy any space on the browser.

    Page Load event may be used to show/hide the control.

    "Jeff" <> wrote in message
    news:%...
    I agree on that but if I hide the control, will the UserControl display
    still reserve space for the hided control?

    In other words this control I want to hide/show is (400 pixels height and
    witdth=100%) placed at the top of the UserControl. If this control is hidden
    will the UserControl still reserve space (400 pixels height and witdth=100%)
    for the hidden control??....

    and in what event should I hide/show the control?

    Jeff


    "Siva M" <> wrote in message
    news:ORHQ%...
    >I prefer the second approach because it is easy to make changes later at
    >one
    > place instead of two.
    >
    > "Jeff" <> wrote in message
    > news:...
    > Hey
    >
    > ASP.NET 2.0
    >
    > I'm about to create a UserControl for my web project, but I'm wondering if
    > I
    > need to create 2 UserControls instead. Because these UserControls will be
    > very similar, the only difference between them will be that one of these
    > UserControls are containing a control (also being a UserControl, lets call
    > it "A"), which the other UserControl don't contain!
    >
    > So I thought about creating 2 different UserControls... but I guess this
    > would be bad, because these 2 UserControls will have the same markup,
    > except
    > one the UserControls have a control ("A", mention above) which the other
    > userControl don't have
    >
    > Or I could instead create only 1 UserControl, have have some logic in it
    > which hide or show the control ("A"). In this way I could use only
    > UserControl and use some kind of logic to hide or show this extra control
    > ("A")... I guess this approach is the best, but would like to know your
    > thought about this too?
    >
    > Best Regards
    >
    > Jeff
    >
    >
     
    Siva M, Oct 14, 2006
    #4
  5. Jeff

    Jeff Guest

    Thanks!



    "Siva M" <> wrote in message
    news:...
    > Set the Visible property to False. This wil not generate any markup nor
    > will
    > it occupy any space on the browser.
    >
    > Page Load event may be used to show/hide the control.
    >
    > "Jeff" <> wrote in message
    > news:%...
    > I agree on that but if I hide the control, will the UserControl display
    > still reserve space for the hided control?
    >
    > In other words this control I want to hide/show is (400 pixels height and
    > witdth=100%) placed at the top of the UserControl. If this control is
    > hidden
    > will the UserControl still reserve space (400 pixels height and
    > witdth=100%)
    > for the hidden control??....
    >
    > and in what event should I hide/show the control?
    >
    > Jeff
    >
    >
    > "Siva M" <> wrote in message
    > news:ORHQ%...
    >>I prefer the second approach because it is easy to make changes later at
    >>one
    >> place instead of two.
    >>
    >> "Jeff" <> wrote in message
    >> news:...
    >> Hey
    >>
    >> ASP.NET 2.0
    >>
    >> I'm about to create a UserControl for my web project, but I'm wondering
    >> if
    >> I
    >> need to create 2 UserControls instead. Because these UserControls will be
    >> very similar, the only difference between them will be that one of these
    >> UserControls are containing a control (also being a UserControl, lets
    >> call
    >> it "A"), which the other UserControl don't contain!
    >>
    >> So I thought about creating 2 different UserControls... but I guess this
    >> would be bad, because these 2 UserControls will have the same markup,
    >> except
    >> one the UserControls have a control ("A", mention above) which the other
    >> userControl don't have
    >>
    >> Or I could instead create only 1 UserControl, have have some logic in it
    >> which hide or show the control ("A"). In this way I could use only
    >> UserControl and use some kind of logic to hide or show this extra control
    >> ("A")... I guess this approach is the best, but would like to know your
    >> thought about this too?
    >>
    >> Best Regards
    >>
    >> Jeff
    >>
    >>

    >
    >
     
    Jeff, Oct 14, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Greg Linwood
    Replies:
    4
    Views:
    554
    Greg Linwood
    Dec 3, 2003
  2. Paul
    Replies:
    3
    Views:
    430
    Scott Allen
    Apr 30, 2004
  3. milesm
    Replies:
    1
    Views:
    357
    Steve C. Orr [MVP, MCSD]
    May 6, 2004
  4. D. Shane Fowlkes
    Replies:
    0
    Views:
    587
    D. Shane Fowlkes
    May 11, 2004
  5. Larry Rekow
    Replies:
    1
    Views:
    515
    Hermit Dave
    Aug 31, 2004
Loading...

Share This Page