Results 1 to 3 of 3

Thread: [Resolved] Dynamic control - Style

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2006
    Location
    CA, USA
    Posts
    81

    [Resolved] Dynamic control - Style

    Hi all,

    I am working with a custom tab control which can add tabs dynamically. For this my control uses <div> to each tag. At design time my div tag is like this:

    <div id="divTab1" style="DISPLAY:none">

    In this case it works fine. Where as when I am generating the div dynamically using the following code, there is a visibility problem with the tab. I tested the page by removing style="DISPLAY:none" from my design time div tag and it shows the same problem.

    foreach (string tabNm in tmpClass.strArray)
    {
    System.Web.UI.HtmlControls.HtmlGenericControl myDiv;
    myDiv = new HtmlGenericControl("div");
    myDiv.ID = "div" + tabTitle;

    this.Controls.Add(myDiv);
    }

    How can i give style="DISPLAY:none" when I am generating the div dynamically?
    Last edited by kiran_q8; Jun 1st, 2007 at 12:03 PM.

  2. #2
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092

    Re: Dynamic control - Style

    You could do this
    Code:
    myDiv.Attributes.Add("style", "DISPLAY:none");

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Apr 2006
    Location
    CA, USA
    Posts
    81

    Re: Dynamic control - Style

    wow cool stuf... it works fine... thanks fishcake

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width