S
SimeonArgus
Okay. I have the following situation. It is a basic case where a
dynamic button needs to remove itself after an action, and handle some
minor database flags.
public partial class ReportFrame : System.Web.UI.Page
{
DBConnection DB;
//protected void Page_Load(object sender, EventArgs e)
protected void Page_Init(object sender, EventArgs e)
{
// Okay, let's do some cleanup here.
DB = GeneralTools1.DB;
}
protected void Page_Load(object sender, EventArgs e)
{
foreach (string S in DB.GetNextRow())
{
Button B = new Button();
B.Text = S;
B.Click +=new EventHandler(B_Click);
MyPanel.Controls.Add(B);
}
}
protected void B_Click(object sender, EventArgs e)
{
Button B = (Button)sender;
// Do some SQL Stuff here to tell the database that B.Text has
been removed.
DB.DisableButton(B.Text);
}
}
PageLoad looks to see what buttons are "enabled" in the database. The
problem? B_Click happens AFTER PageLoad. Is there any way to do this
simple routine that I am over looking? This is a stripped down case,
In reality, the button click does alot with what is visible, etc.
However, this should get the gist of it in a simple-to-read version.
dynamic button needs to remove itself after an action, and handle some
minor database flags.
public partial class ReportFrame : System.Web.UI.Page
{
DBConnection DB;
//protected void Page_Load(object sender, EventArgs e)
protected void Page_Init(object sender, EventArgs e)
{
// Okay, let's do some cleanup here.
DB = GeneralTools1.DB;
}
protected void Page_Load(object sender, EventArgs e)
{
foreach (string S in DB.GetNextRow())
{
Button B = new Button();
B.Text = S;
B.Click +=new EventHandler(B_Click);
MyPanel.Controls.Add(B);
}
}
protected void B_Click(object sender, EventArgs e)
{
Button B = (Button)sender;
// Do some SQL Stuff here to tell the database that B.Text has
been removed.
DB.DisableButton(B.Text);
}
}
PageLoad looks to see what buttons are "enabled" in the database. The
problem? B_Click happens AFTER PageLoad. Is there any way to do this
simple routine that I am over looking? This is a stripped down case,
In reality, the button click does alot with what is visible, etc.
However, this should get the gist of it in a simple-to-read version.