how to make two or more User Controls to interact with each other

Discussion in 'ASP .Net' started by triveni.chandran@gmail.com, Jul 11, 2006.

  1. Guest

    I have two ascx files (header.ascx,footer.ascx) on default.aspx file.
    In header.ascx file User Control hosts a DropDownList containing a list
    of Colors. if any change event occurs in the dropdown list,it should
    reflect in the footer.ascx file label.

    please can any one tell me vb coding.
    Thanks in Advance.
     
    , Jul 11, 2006
    #1
    1. Advertising

  2. Karl Seguin [MVP], Jul 11, 2006
    #2
    1. Advertising

  3. I don't think the goal is for the header and footer controls to communicate
    with one another.

    In your header create a public event, call it "ColorChanged" or whatever.
    Also create a property called CurrentColor. Then on the default page add an
    event handler to the ColorChanged event. When the SelectedIndexChanged event
    fires for the droplist then set the CurrentColor property and fire your
    ColorChanged event.

    In the ColorChanged event handler get the CurrentColor and call a method on
    the Footer control, call it ShowColor, and pass it the CurrentColor as a
    parameter.

    --
    -Demetri


    "" wrote:

    > I have two ascx files (header.ascx,footer.ascx) on default.aspx file.
    > In header.ascx file User Control hosts a DropDownList containing a list
    > of Colors. if any change event occurs in the dropdown list,it should
    > reflect in the footer.ascx file label.
    >
    > please can any one tell me vb coding.
    > Thanks in Advance.
    >
    >
     
    =?Utf-8?B?RGVtZXRyaQ==?=, Jul 11, 2006
    #3
  4. On a related note, I was trying to change the background color of a
    table cell (<td>) upon the click of a button, and the following code
    wouldn't work:

    TableCell.Background-color = "#990000";

    I get an error to the effect of "Unable to implicitly convert string
    value to type System.Color".

    How do I go about assigning a color to an object in this manner?

    Rich


    Demetri wrote:
    > I don't think the goal is for the header and footer controls to communicate
    > with one another.
    >
    > In your header create a public event, call it "ColorChanged" or whatever.
    > Also create a property called CurrentColor. Then on the default page add an
    > event handler to the ColorChanged event. When the SelectedIndexChanged event
    > fires for the droplist then set the CurrentColor property and fire your
    > ColorChanged event.
    >
    > In the ColorChanged event handler get the CurrentColor and call a method on
    > the Footer control, call it ShowColor, and pass it the CurrentColor as a
    > parameter.
    >
    > --
    > -Demetri
    >
    >
    > "" wrote:
    >
    > > I have two ascx files (header.ascx,footer.ascx) on default.aspx file.
    > > In header.ascx file User Control hosts a DropDownList containing a list
    > > of Colors. if any change event occurs in the dropdown list,it should
    > > reflect in the footer.ascx file label.
    > >
    > > please can any one tell me vb coding.
    > > Thanks in Advance.
    > >
    > >
     
    Richard Carpenter, Jul 11, 2006
    #4
  5. Guest

    there may be a simpler way to do this, but...

    System.Drawing.ColorConverter cc = new
    System.Drawing.ColorConverter();
    System.Drawing.Color c = (System.Drawing.Color)
    cc.ConvertFromString("#990000");

    TableCell.BackColor = c;


    Richard Carpenter wrote:
    > On a related note, I was trying to change the background color of a
    > table cell (<td>) upon the click of a button, and the following code
    > wouldn't work:
    >
    > TableCell.Background-color = "#990000";
    >
    > I get an error to the effect of "Unable to implicitly convert string
    > value to type System.Color".
    >
    > How do I go about assigning a color to an object in this manner?
    >
    > Rich
    >
    >
    > Demetri wrote:
    > > I don't think the goal is for the header and footer controls to communicate
    > > with one another.
    > >
    > > In your header create a public event, call it "ColorChanged" or whatever.
    > > Also create a property called CurrentColor. Then on the default page add an
    > > event handler to the ColorChanged event. When the SelectedIndexChanged event
    > > fires for the droplist then set the CurrentColor property and fire your
    > > ColorChanged event.
    > >
    > > In the ColorChanged event handler get the CurrentColor and call a method on
    > > the Footer control, call it ShowColor, and pass it the CurrentColor as a
    > > parameter.
    > >
    > > --
    > > -Demetri
    > >
    > >
    > > "" wrote:
    > >
    > > > I have two ascx files (header.ascx,footer.ascx) on default.aspx file.
    > > > In header.ascx file User Control hosts a DropDownList containing a list
    > > > of Colors. if any change event occurs in the dropdown list,it should
    > > > reflect in the footer.ascx file label.
    > > >
    > > > please can any one tell me vb coding.
    > > > Thanks in Advance.
    > > >
    > > >
     
    , Jul 11, 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. KathyB
    Replies:
    0
    Views:
    375
    KathyB
    Jul 4, 2003
  2. lltaylor
    Replies:
    1
    Views:
    396
    Steve C. Orr [MVP, MCSD]
    Jun 30, 2004
  3. Ling
    Replies:
    2
    Views:
    854
  4. Matt Adamson
    Replies:
    0
    Views:
    178
    Matt Adamson
    Feb 25, 2007
  5. Robert Wallace

    substitute two ore more with two or more

    Robert Wallace, Dec 31, 2003, in forum: Perl Misc
    Replies:
    1
    Views:
    111
    Big and Blue
    Dec 31, 2003
Loading...

Share This Page