TabStrip web control

Discussion in 'ASP .Net Web Controls' started by Gabriel Enea, Jan 26, 2004.

  1. Gabriel Enea

    Gabriel Enea Guest

    Hello,

    I'm trying to develop my TabStrip web control but seems there is some
    troubles in the desing mode.
    Initially, I have defined a collection of TabButton in the TabStrip web
    control. The TabButton inherits the functionality of the
    System.Web.UI.WebControls.Button. In the Render method, for each tab I've
    added the click javascript event as follows:

    protected override void Render(HtmlTextWriter output)
    {
    ....
    but.Attributes.Add("onclick", "javascript: " +
    Page.GetPostBackEventReference(this, "but" + i.ToString()));
    ....

    But, after that I've a problem in the design mode when I try to add more
    items (TabButton instance in the Items (TabButtonCollection) collection
    because the VS adds automatically the 'click' attribute in the design mode:

    <cc1:TabStrip id="TabStrip3" style="Z-INDEX: 103; LEFT: 152px; POSITION:
    absolute; TOP: 352px" runat="server">
    <cc1:TabButton Text="tabButton1" onclick="javascript:
    __doPostBack('TabStrip3','but0')"></cc1:TabButton>
    <cc1:TabButton Text="tabButton2" onclick="javascript:
    __doPostBack('TabStrip3','but1')"></cc1:TabButton>
    <cc1:TabButton Text="tabButton3" onclick="javascript:
    __doPostBack('TabStrip3','but2')"></cc1:TabButton>
    </cc1:TabStrip>

    which should like:

    <cc1:TabStrip id="TabStrip3" style="Z-INDEX: 103; LEFT: 152px; POSITION:
    absolute; TOP: 352px" runat="server">
    <cc1:TabButton Text="tabButton1"></cc1:TabButton>
    <cc1:TabButton Text="tabButton2"></cc1:TabButton>
    <cc1:TabButton Text="tabButton3"></cc1:TabButton>
    </cc1:TabStrip>


    Please, tell me if there is a way to know in the control if I am in the
    design mode or at runtime. Note that the control renders correctly at the
    runtime.


    Best regards,

    Gabriel.


    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system (http://www.grisoft.com).
    Version: 6.0.566 / Virus Database: 357 - Release Date: 22.01.2004
     
    Gabriel Enea, Jan 26, 2004
    #1
    1. Advertising

  2. You are seing this becuase you are generating Java Scipt in the render
    method, which is called by the designer when displaying your page in design
    view.

    If you override the OnPreRedner method, and use
    Page.RegisterClientScriptBlock or Page.RegisterStartupScript to register
    your script on the page your script code will be rendered by the page's
    render method, and not by the control. When viewed in the deisgner the page
    will not render any registered script blocks.


    -Scott Wisniewski

    "Gabriel Enea" <> wrote in message
    news:%23UhfK%...
    > Hello,
    >
    > I'm trying to develop my TabStrip web control but seems there is some
    > troubles in the desing mode.
    > Initially, I have defined a collection of TabButton in the TabStrip web
    > control. The TabButton inherits the functionality of the
    > System.Web.UI.WebControls.Button. In the Render method, for each tab I've
    > added the click javascript event as follows:
    >
    > protected override void Render(HtmlTextWriter output)
    > {
    > ...
    > but.Attributes.Add("onclick", "javascript: " +
    > Page.GetPostBackEventReference(this, "but" + i.ToString()));
    > ...
    >
    > But, after that I've a problem in the design mode when I try to add more
    > items (TabButton instance in the Items (TabButtonCollection) collection
    > because the VS adds automatically the 'click' attribute in the design

    mode:
    >
    > <cc1:TabStrip id="TabStrip3" style="Z-INDEX: 103; LEFT: 152px; POSITION:
    > absolute; TOP: 352px" runat="server">
    > <cc1:TabButton Text="tabButton1" onclick="javascript:
    > __doPostBack('TabStrip3','but0')"></cc1:TabButton>
    > <cc1:TabButton Text="tabButton2" onclick="javascript:
    > __doPostBack('TabStrip3','but1')"></cc1:TabButton>
    > <cc1:TabButton Text="tabButton3" onclick="javascript:
    > __doPostBack('TabStrip3','but2')"></cc1:TabButton>
    > </cc1:TabStrip>
    >
    > which should like:
    >
    > <cc1:TabStrip id="TabStrip3" style="Z-INDEX: 103; LEFT: 152px; POSITION:
    > absolute; TOP: 352px" runat="server">
    > <cc1:TabButton Text="tabButton1"></cc1:TabButton>
    > <cc1:TabButton Text="tabButton2"></cc1:TabButton>
    > <cc1:TabButton Text="tabButton3"></cc1:TabButton>
    > </cc1:TabStrip>
    >
    >
    > Please, tell me if there is a way to know in the control if I am in the
    > design mode or at runtime. Note that the control renders correctly at the
    > runtime.
    >
    >
    > Best regards,
    >
    > Gabriel.
    >
    >
    > ---
    > Outgoing mail is certified Virus Free.
    > Checked by AVG anti-virus system (http://www.grisoft.com).
    > Version: 6.0.566 / Virus Database: 357 - Release Date: 22.01.2004
    >
    >
     
    Scott Wisniewski, Jan 29, 2004
    #2
    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. Flynn Arrowstarr

    TabStrip in User Web Control

    Flynn Arrowstarr, Nov 26, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    408
    Saravana [MVP]
    Nov 27, 2003
  2. Mark Rae

    Re: Tabstrip Control for web forms

    Mark Rae, Apr 14, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    354
    Mark Rae
    Apr 14, 2005
  3. Replies:
    1
    Views:
    2,070
    =?Utf-8?B?bWF0Y2hieA==?=
    Jul 20, 2005
  4. nail

    Create a web tabstrip control

    nail, Sep 2, 2004, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    113
  5. Geoff Pennington

    Tabstrip control for web pages?

    Geoff Pennington, Oct 29, 2003, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    148
    vMike
    Oct 29, 2003
Loading...

Share This Page