PC Review


Reply
Thread Tools Rate Thread

Cannot get the command event to work... please help

 
 
M. Ali Qureshi
Guest
Posts: n/a
 
      11th Jan 2008
Hi Experts,

I am trying to add some linkbuttons dynamically with Command eventhandler.
But this event just does not get fired when i click on the button. See
following:

Function GetLink(ByVal Folder As Boolean, ByVal LinkText As String,
ByVal FolderPath As String) As LinkButton
Dim EditUrl As New LinkButton
EditUrl.Text = LinkText
EditUrl.CommandName = "FolderLink"
EditUrl.CommandArgument = FolderPath
AddHandler EditUrl.Command, AddressOf LinkClick
Return EditUrl
End Function

Protected Sub LinkClick(ByVal sender As Object, ByVal e As
CommandEventArgs)
If e.CommandName.CompareTo("FolderLink") = "0" Then
Response.Redirect("EditNav.aspx?NavID=" &
e.CommandArgument.ToString())
End If
End Sub

The code "LinkClick" does not get fired when i click on the linkbuttons.
Pleaes help... its killing me!!!
 
Reply With Quote
 
 
 
 
Mark Rae [MVP]
Guest
Posts: n/a
 
      11th Jan 2008
"M. Ali Qureshi" <M. Ali (E-Mail Removed)> wrote in message
news:2D9DDEF3-92F0-44A3-8442-(E-Mail Removed)...

> The code "LinkClick" does not get fired when i click on the linkbuttons.


If you're calling GetLink during Page_Load, that's too late in the page
lifecycle - move it into Page_Init or Page_PreInit instead...


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Textbox LostFocus event fires after Command Button's OnClick event teddysnips@hotmail.com Microsoft VB .NET 14 10th Aug 2006 01:47 PM
FOR command does not work when a command is used to generate the (set). Marshall Buhl Windows XP General 1 10th Feb 2006 12:12 AM
Command to run Norton Viral Scan run box or command prompt/ "navwn32" doesn't work Chad Harris Windows XP Customization 8 16th Aug 2004 11:02 PM
ErrorHandler behind command button event property in form fails to work. Frank Microsoft Access Form Coding 4 21st Apr 2004 05:38 PM
Do I need to override the OnClosing event when I'm closing a thread or would the Form_Closing event would work fine? Asheesh Microsoft Dot NET Compact Framework 2 6th Feb 2004 06:28 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:12 PM.