Question About ASP.NET 2.0

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Gunawan

    Question About ASP.NET 2.0

    Hi All,
    I would like to know how I perform action like this

    if (expression)
    {
    //true block
    create a table contain 3 column
    }
    else
    {
    //false block
    create some text box
    }

    on classic ASP I could use response.write statement how about ASP.NET

    Thank you in advance
    Regards,
    Gun


  • Bruno Alexandre

    #2
    Re: Question About ASP.NET 2.0

    you can always use Panels...

    Panels are live DIV tags that you can Hide or Show when you want... so
    imagine that you have 2 panels

    <asp:Panel id="p1" ...

    your table contain 3 coluns goes here

    </asp:Panel>
    <asp:Panel id="p2" ...

    your textbox cames here

    </asp:Panel>


    then in Page_Load do:

    p1.visible = false;
    p2.visible = false;

    so you start with both hidden

    then you can use your condition to do what you need...

    if (expression)
    {
    //true block
    //create a table contain 3 column
    p1.visible = true;
    p2.visible = false;
    }
    else
    {
    //false block
    //create some text box
    p1.visible = false;
    p2.visible = true;
    }


    remember that you can Hide/Show all components/tags you have in the page...
    if you want to hide a table, just add id and runat="server" like

    <table id="myTable" runat="server">
    ....


    and you can hide the table using just myTable.visible = false;


    --

    Bruno Alexandre
    (a Portuguese in Københanv, Danmark)


    "Gunawan" <jgun98.milis@g mail.com> escreveu na mensagem
    news:u5bcOWsiGH A.1612@TK2MSFTN GP04.phx.gbl...[color=blue]
    > Hi All,
    > I would like to know how I perform action like this
    >
    > if (expression)
    > {
    > //true block
    > create a table contain 3 column
    > }
    > else
    > {
    > //false block
    > create some text box
    > }
    >
    > on classic ASP I could use response.write statement how about ASP.NET
    >
    > Thank you in advance
    > Regards,
    > Gun
    >[/color]


    Comment

    Working...