Question About ASP.NET 2.0

  • Thread starter Thread starter Gunawan
  • Start date Start date
G

Gunawan

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
 
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;
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top