B
Burak
Hello,
This is my code behind code for dynamic link button creation:
strUrl = "<asp:LinkButton CommandName='Onet3_Cd'
onfiltered='LinkButton_Command' runat='server' " & _
"Text='" & rdrOnet3("ONET3_TITLE") & "'
CommandArgument='" & rdrOnet3("ONET3_CD") & "' id='lb"
& i & "'></asp:LinkButton>"
Dim ctrl As Control =
Page.ParseControl(strUrl.ToString())
plcCategory.Controls.Add(ctrl) ' place holder on html page
The link button shows up fine when I run this, but
when I click on the link, it doesn't take me to
Sub LinkButton_Command(ByVal sender As Object, ByVal e
As CommandEventArgs)
Dim strDesc As String
strDesc = sender.text
Response.Write(sender.text)
End Sub
I based my code on
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlr\
fsystemwebuiwebcontrolslinkbuttonclasscommandnametopic.asp
The click works if I hard code the link button on the
html page, but if I create it dynamically, the click
does not take me to the above sub.
Do you know how to fix this?
Thanks,
Burak
This is my code behind code for dynamic link button creation:
strUrl = "<asp:LinkButton CommandName='Onet3_Cd'
onfiltered='LinkButton_Command' runat='server' " & _
"Text='" & rdrOnet3("ONET3_TITLE") & "'
CommandArgument='" & rdrOnet3("ONET3_CD") & "' id='lb"
& i & "'></asp:LinkButton>"
Dim ctrl As Control =
Page.ParseControl(strUrl.ToString())
plcCategory.Controls.Add(ctrl) ' place holder on html page
The link button shows up fine when I run this, but
when I click on the link, it doesn't take me to
Sub LinkButton_Command(ByVal sender As Object, ByVal e
As CommandEventArgs)
Dim strDesc As String
strDesc = sender.text
Response.Write(sender.text)
End Sub
I based my code on
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlr\
fsystemwebuiwebcontrolslinkbuttonclasscommandnametopic.asp
The click works if I hard code the link button on the
html page, but if I create it dynamically, the click
does not take me to the above sub.
Do you know how to fix this?
Thanks,
Burak