Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Linkbutton command does not fire
Message
 
To
26/01/2004 09:28:57
Martin Van Krieken
Capgemini Nederland Bv
Utrecht, Netherlands
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00870542
Message ID:
00870612
Views:
8
Hi Martin,

The problem here is with ViewState not finding the controls. Here is an article that describes how to dynamically add controls and load them in ViewState.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cscon/html/vctskcodeaddingcontrolsatruntimevisualc.asp

>Hello,
>
>I'm building an ASP.NET (1.1) application. On a page I have a PlaceHolder object. In the code behind file I determine the kind of object to add to the PlaceHolder. Sometimes a LinkButton is added like this:
>
>LinkButton myLinkButton = new LinkButton();
>myLinkButton.Text = "Some text";
>myLinkButton.CommandArgument = "SomeArgument";
>myLinkButton.Command += new CommandEventHandler(MyCommandHandler);
>myPlaceHolder.Controls.Add(myLinkButton);
>
>When I run the app I get a linkButton on my form, but when I click on it MyCommandHandler is never executed. MyCommandHandler lokks like this:
>
>protected void MyCommandHandler(Object sender, CommandEventArgs e)
>{
>DoSomething();
>}
>
>I also tried the Click event, but with the same result. What's wrong with my code?
>
>
>TIA,
>
>Martin
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Previous
Reply
Map
View

Click here to load this message in the networking platform