473,657 Members | 2,655 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Programmaticall y creating a asp.net 2.0 linkbutton

Hi there,

The other day I tried to programmaticall y create an asp.net linkbutton
during my Page_Load() event and attach a click event handler to the
linkbutton, then add that linkbutton control to a particular cell in a
gridview control. The button appeared where I expected it on the page but
when I clicked on it, the button just disappeared. I was in debug mode with
a breakpoint set up in my click event handler and the debugger never caught
the breakpoint, so I'm guessing the click event was never fired. Any ideas?
I can try to whip up a code sample if you think it'll help explain my
situation.

Thanks in advance =-)
- Gabe
Jul 20 '06 #1
3 2788
if you're putting it inside of the gridview, why aren't you doing so in
the gridview_onrowd atabound event? Is it for every row? What is it
you're trying to accomplish?

Code would be helpful to solve your problem.
Gabe wrote:
Hi there,

The other day I tried to programmaticall y create an asp.net linkbutton
during my Page_Load() event and attach a click event handler to the
linkbutton, then add that linkbutton control to a particular cell in a
gridview control. The button appeared where I expected it on the page but
when I clicked on it, the button just disappeared. I was in debug mode with
a breakpoint set up in my click event handler and the debugger never caught
the breakpoint, so I'm guessing the click event was never fired. Any ideas?
I can try to whip up a code sample if you think it'll help explain my
situation.

Thanks in advance =-)
- Gabe
Jul 20 '06 #2
Thanks for your super-quick reply =-)

I have since come up with a different solution that doesn't cause me any
problems (not using gridview or dynamic linkbuttons anymore). If I have some
free time tomorrow, I'll try putting a code sample together just to show you
exactly what was going wrong. But it's not super critical anymore.

In any event, thanks again for your quick response.
- Gabe

"tfsmag" wrote:
if you're putting it inside of the gridview, why aren't you doing so in
the gridview_onrowd atabound event? Is it for every row? What is it
you're trying to accomplish?

Code would be helpful to solve your problem.
Gabe wrote:
Hi there,

The other day I tried to programmaticall y create an asp.net linkbutton
during my Page_Load() event and attach a click event handler to the
linkbutton, then add that linkbutton control to a particular cell in a
gridview control. The button appeared where I expected it on the page but
when I clicked on it, the button just disappeared. I was in debug mode with
a breakpoint set up in my click event handler and the debugger never caught
the breakpoint, so I'm guessing the click event was never fired. Any ideas?
I can try to whip up a code sample if you think it'll help explain my
situation.

Thanks in advance =-)
- Gabe

Jul 20 '06 #3
No problem, things are kinda slow today so i figured I'd hop on here
and see if I could help out and maybe learn something in the process :D
Gabe wrote:
Thanks for your super-quick reply =-)

I have since come up with a different solution that doesn't cause me any
problems (not using gridview or dynamic linkbuttons anymore). If I have some
free time tomorrow, I'll try putting a code sample together just to show you
exactly what was going wrong. But it's not super critical anymore.

In any event, thanks again for your quick response.
- Gabe

"tfsmag" wrote:
if you're putting it inside of the gridview, why aren't you doing so in
the gridview_onrowd atabound event? Is it for every row? What is it
you're trying to accomplish?

Code would be helpful to solve your problem.
Gabe wrote:
Hi there,
>
The other day I tried to programmaticall y create an asp.net linkbutton
during my Page_Load() event and attach a click event handler to the
linkbutton, then add that linkbutton control to a particular cell in a
gridview control. The button appeared where I expected it on the page but
when I clicked on it, the button just disappeared. I was in debug mode with
a breakpoint set up in my click event handler and the debugger never caught
the breakpoint, so I'm guessing the click event was never fired. Any ideas?
I can try to whip up a code sample if you think it'll help explain my
situation.
>
Thanks in advance =-)
- Gabe
Jul 20 '06 #4

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

Similar topics

0
296
by: Mike P | last post by:
Can anybody tell me what is wrong with this code? The main error I seem to be getting is where I am creating the LinkButton called deleteButton. public void dgLog_ItemDataBound(object sender, DataGridItemEventArgs e) { //First, make sure we're NOT dealing with a Header or Footer row if (!(e.Item.ItemType == ListItemType.Header) && (!(e.Item.ItemType == ListItemType.Footer))) { //Now, reference the LinkButton control that the Delete...
0
1238
by: Vilmar Brazão de Oliveira | last post by:
Hi, I am having err when creating link to each line of grid at LINE 38. My objective in asp.net is: each line can be linked to page with your parameters as VB 5/6, Delphi 5/6/7, etc.... See the code bellow: Thanks! --------------------------------------- Vilmar Brazão de Oliveira HI-TEC Informática
3
1461
by: simon | last post by:
Hello, i'm looking to create an aspx page that is basically a FAQ page i'm not sure if this can be done, but would love some help with suggestions of how to do it another way if this is not possible on the aspx page i have a table with 1 row and 2 columns in it, in the column on the left i have an asp:label, lblLinks and in the column on the right i have another asp:label, lblBody i'm reading the content of the links and body from...
1
2960
by: simon | last post by:
Hello, i'm looking to create an aspx page that is basically a FAQ page i'm not sure if this can be done, but would love some help with suggestions of how to do it another way if this is not possible on the aspx page i have a table with 1 row and 2 columns in it, in the column on the left i have an asp:label, lblLinks and in the column on the right i have another asp:label, lblBody i'm reading the content of the links and body from...
2
2605
by: Nathan Sokalski | last post by:
I am trying to create a FormView controls in which I access and modify the the controls in the PagerTemplate programmatically. However, I continue to recieve the following error: Object reference not set to an instance of an object. I am attempting to access the controls in my PagerTemplate using the following code: CType(Me.fviewPhotoAlbum.FindControl("lnkPhotoAlbum"), LinkButton)
3
2014
by: Ben | last post by:
Hi, i try to reach in code-behind a linkbutton embedded into an ItemTemplate element of a gridview. But i'm stuck .... <Columns> <asp:TemplateField><ItemTemplate> <asp:LinkButton ID="lb1" runat="server" OnClientClick="return confirm(Sure?');"
5
2297
by: tshad | last post by:
I found I can create Template columns dynamically - as long as I don't use objects that need onclick events, such as a LinkButton. Textboxes and Labels work fine. I create the Template columns like so: Dim column as TemplateColumn = new TemplateColumn() column.HeaderText = "Template Column" column.ItemStyle.Width = Unit.Pixel(width) column.HeaderStyle.Width = Unit.Pixel(width)
0
1370
by: Syoam4ka | last post by:
My project is about jewellery. I have devided my jewelery into main types, which each one of them has sub types, and each one those sub types has the jewellery. I have a tabcontainer. It includes tabpanels such as:Catalog,Terms,SiteMap.ViewCart ,etc. All the jewellery Intro is in the Catalog panel. when I first click the Catalog panel it Introduces me all the main types of the jewellery(It's all done dynamically from the cs file).The...
1
2958
by: ata | last post by:
Hi, I need to create a PopupControlExtender dynamically, and attach it to a LinkButton. i.e., when the LinkButton is clicked, I would like to display a given literal control to the user. So, I tried the following code: LinkButton link = new LinkButton(); link.ID = "imgOtherAttributes" + caid; link.CausesValidation = false; link.Text = "other options";
0
8385
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8303
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
7316
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4300
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1601
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.