Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Web Form +Dynamic Button +C#

Status
Not open for further replies.

McKaulick

Programmer
Oct 24, 2002
35
AR
Hi all, here's my problem, I have a dynamic form that contains a profile, all the textboxes in the form are enabled = false. When I click on a dynamic hyperlink I pass a value that puts all the textboxes enabled = true and I create a Button, I want to call a function with this button that will do a sql request. But my problem is, the function wont start...

Here's some code :

if (passe == false)
{
HyperLink btn = new HyperLink();
btn.Target = "main";
btn.Text = "Modifier mon profil";
btn.NavigateUrl = "profile.aspx?passe=true";
tcell.Controls.Add(btn);
}
else
{
Button btn = new Button();
btn.Text = "valider";
btn.Click += new System.EventHandler(this.btnClick);
tcell.Controls.Add(btn);
}

And then I have the function...

private void btnClick(Object sender, EventArgs e)
{
Response.Write("I clicked it, wont work!!");
}

What I did wrong?

thx!

Mc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top