473,406 Members | 2,378 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Custom control linkbutton events

Hi,

I hope someone can help. I've created a custom webcontrol library
which generates a web table, and within each row dynamically creates a
LinkButton control.

The Linkbutton code looks like this :

oGenRow = New TableRow

oLnkRemove = New WebControls.LinkButton
oLnkRemove.Text = "remove now"
oLnkRemove.CommandName = "Remove"
oLnkRemove.CommandArgument =
CType(oIdictEnum.Current, DataRowView).Item("ID").ToString()
oLnkRemove.CausesValidation = True
oLnkRemove.Attributes.Add("name",
oLnkRemove.ClientID)
'oLnkRemove.Attributes.Add("href",
"javascript:__doPostBack('lnkRemove_" + iRow.ToString + "','')")
oLnkRemove.EnableViewState = True
oLnkRemove.ID = "lnkRemove_" +
iRow.ToString

This is then added to the control collection of the table cell object,
which is then added to the row, and so on.

The problem I've got is even if I user the AddHandler command for the
Command event of the Linkbutton, the rendered output just renders an
anchor with no properties, so you can't click it and no event is fired
off.

I've tried load of things based on solutions online, but some look
really complicated (loads of delegates etc), and others that just
don't work.

It seems such a simple thing to be able to do. Perhaps I'm
misunderstanding how the custom web control interacts with the page
it's placed on - at this point I'm completely lost!

Hope someone can help,
Tony

Jun 18 '07 #1
0 1211

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: doron | last post by:
Hi, I'm tryig to add a LinkButton with events to a custom control (custom control : Datagrid) My CreateChildControls is generating an error (Specified cast is not valid.) Here is my...
3
by: doron | last post by:
Hi, I'm tryig to add a LinkButton with events to a custom control (custom control : Datagrid) My CreateChildControls is generating an error (Specified cast is not valid.)
7
by: moondaddy | last post by:
I have a user control being used instead of a frame page. when the user clicks on a menu item I need to send the ID (integer value) of that menu as a parameter in the postback of the user control...
0
by: spacehopper_man | last post by:
hi - I am writing a "tab" control. - but it's losing the viewstate of the content pane when I switch between tabs. can anyone shed any light on why I'm losing ViewState based on my simple...
0
by: Walter | last post by:
Hi, can someone please help me with my custom control viewstate problem....I haven't slept for hours trying to get this fixed. I am making two custom controls which will be included on a single...
0
by: OceanBreeze | last post by:
I have added a LinkButton to a table cell programmatically inside the Page_Load method. I also added a custom event to that link button. The same custom event is valid for all the link buttons. The...
8
by: =?Utf-8?B?QXNo?= | last post by:
Hi, I have an object, for example User. User contains various properties which i have been able to bind to successfully using wizards and the form view. However if the class User has a property...
3
by: ronchese | last post by:
Hello. I wrote a Web Custom Control that have a property named SelectedValue. This SelectedValue property is set after the user clicks a LinkButton control, by its Click() event. I did some...
16
by: pupilstuff | last post by:
hi guys i just want to perform custom paging in which at the footer of the grid view ,there must be a pager 'pervious/next with numeric' this is what i did in aspx page <asp:GridView...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.