Hi,
If I changed the asp script to below:
void Page_Load()
{
if (IsPostBack)
{
if (Request.Form["list1"] != "")
message.Text = "You have selected " + Request.Form["list1"];
else
message.Text = "You have selected nothing";
}
}
and select nothing from the listbox, the label(message) should display "You have selected nothing". Why is that it still display "You have selected " ??
R there a lot of bugs inside Wrox book?
Quote:
quote:Originally posted by NotNowJohn
If you want to prevent the label's text from appearing you can use IsPostBack page's property. That means that the code piece will be run only if the form has submitted.
Code:
void Page_Load()
{
if (IsPostBack)
{
if (Request.Form["list1"] != "")
{
message.Text = "You have selected " + Request.Form["list1"];
}
}
}
Regs,
NNJ
...but the Soon is eclipsed by the Moon
|