473,471 Members | 1,881 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Link Button will not fire

Hello,

In my aspx file I have a LinkButton inside a template column, inside a
datagrid.
I have assigned a CommandName to the button.

In my code behind, I attempt to trap the command in the ItemCooamd for
the Datagrid.
I have used this successfully before with no problems. This time
however, the button will not fire ItemCommand.

I can't see anything wrong after a long time looking. Note that the
datagrid definitely has an id of dg_Users

Please can someone help ?
Thanks.
================================================== ==
Here is a the aspx code for the template column inside the datagrid :

asp:TemplateColumn SortExpression="Name" HeaderText="Name (click name
to edit)"> <HeaderStyle HorizontalAlign="Left" Width="40%"
CssClass="grid-header" VerticalAlign="Middle"></HeaderStyle>
<ItemStyle CssClass="grid-first-item"></ItemStyle>
<ItemTemplate><asp:LinkButton runat="server" ID="btnLinkUsers"
Text="Edit User" CommandArgument='<%# DataBinder.Eval(Container,
"DataItem.UserName") %>' CommandName="InvokeEditUser"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateColumn>
================================================== ====

Here is the code behind (which is never invoked)
Sub dgUsers_ItemCommand(ByVal sender As Object, ByVal e As
DataGridCommandEventArgs)
If e.CommandName = "InvokeEditUser" Then
Response.Redirect("ClientUserDetail.aspx?UserName= " &
CType(e.CommandArgument, String) &
"&index={0}&adminindex={1}&clientid=" & ClientID)
End If
End Sub
================================================== ====

Nov 16 '06 #1
2 1471

Bazza Formez wrote:

Just to correct something .. datagrid is called "dgUsers" (not
"dg_Users" as I wrote above).
Hello,

In my aspx file I have a LinkButton inside a template column, inside a
datagrid.
I have assigned a CommandName to the button.

In my code behind, I attempt to trap the command in the ItemCooamd for
the Datagrid.
I have used this successfully before with no problems. This time
however, the button will not fire ItemCommand.

I can't see anything wrong after a long time looking. Note that the
datagrid definitely has an id of dg_Users

Please can someone help ?
Thanks.
================================================== ==
Here is a the aspx code for the template column inside the datagrid :

asp:TemplateColumn SortExpression="Name" HeaderText="Name (click name
to edit)"> <HeaderStyle HorizontalAlign="Left" Width="40%"
CssClass="grid-header" VerticalAlign="Middle"></HeaderStyle>
<ItemStyle CssClass="grid-first-item"></ItemStyle>
<ItemTemplate><asp:LinkButton runat="server" ID="btnLinkUsers"
Text="Edit User" CommandArgument='<%# DataBinder.Eval(Container,
"DataItem.UserName") %>' CommandName="InvokeEditUser"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateColumn>
================================================== ====

Here is the code behind (which is never invoked)
Sub dgUsers_ItemCommand(ByVal sender As Object, ByVal e As
DataGridCommandEventArgs)
If e.CommandName = "InvokeEditUser" Then
Response.Redirect("ClientUserDetail.aspx?UserName= " &
CType(e.CommandArgument, String) &
"&index={0}&adminindex={1}&clientid=" & ClientID)
End If
End Sub
================================================== ====
Nov 16 '06 #2
I have the answer, and I should have rembered this simple problem.

In the definition of the actual datagrid in the aspx file, I should
have added the OnItemCommand setting that specifies the function to
invoke in the code behind... in my case the function to call is
dgUsers_ItemCommand ...

ie. <asp:datagrid id="dgUsers" runat="server"
OnItemCommand="dgUsers_ItemCommand" ...............etc



Bazza Formez wrote:
Hello,

In my aspx file I have a LinkButton inside a template column, inside a
datagrid.
I have assigned a CommandName to the button.

In my code behind, I attempt to trap the command in the ItemCooamd for
the Datagrid.
I have used this successfully before with no problems. This time
however, the button will not fire ItemCommand.

I can't see anything wrong after a long time looking. Note that the
datagrid definitely has an id of dg_Users

Please can someone help ?
Thanks.
================================================== ==
Here is a the aspx code for the template column inside the datagrid :

asp:TemplateColumn SortExpression="Name" HeaderText="Name (click name
to edit)"> <HeaderStyle HorizontalAlign="Left" Width="40%"
CssClass="grid-header" VerticalAlign="Middle"></HeaderStyle>
<ItemStyle CssClass="grid-first-item"></ItemStyle>
<ItemTemplate><asp:LinkButton runat="server" ID="btnLinkUsers"
Text="Edit User" CommandArgument='<%# DataBinder.Eval(Container,
"DataItem.UserName") %>' CommandName="InvokeEditUser"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateColumn>
================================================== ====

Here is the code behind (which is never invoked)
Sub dgUsers_ItemCommand(ByVal sender As Object, ByVal e As
DataGridCommandEventArgs)
If e.CommandName = "InvokeEditUser" Then
Response.Redirect("ClientUserDetail.aspx?UserName= " &
CType(e.CommandArgument, String) &
"&index={0}&adminindex={1}&clientid=" & ClientID)
End If
End Sub
================================================== ====
Nov 16 '06 #3

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

Similar topics

2
by: Stan | last post by:
I cannot make the link buttons fire ItemCommand from repeater control. Here is the code: <asp:repeater id=rptLetters runat="server"> <itemtemplate> <asp:linkbutton id="lnkLetter"...
6
by: Rod Snyder | last post by:
I'm trying to set up a page with an asp.net link button that would send a user to a certain page and on page load execute a specific stored procedure tied to the button on the previous page. The...
8
by: simon | last post by:
On code behind file: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Not Page.IsPostBack Then Dim ctrl As New LinkButton ctrl.ID =...
0
by: Dailan | last post by:
Hi, I create a tree view. Each node has link button associate with it, which includes add, edit, delete buttons. The way I did is for users who have very low capablity of using computer. Now I...
2
by: Sam Miller | last post by:
Hi, I have a button event that won't fire. I left it on Friday and it worked fine. I came back in on Monday and it won't fire. I tried putting another button and just putting a...
1
by: JJ | last post by:
I have an app and on one page I have Link buttons that will fire up a word doc or at least thats my goal. When someone clicks on a link button I need to find a word doc on server where app resides....
3
by: Mark | last post by:
Assume you want to dynamically add one to many link button controls to a web page dynamically at run time. Each link button needs to post back and execute code. As the link buttons are created at...
5
by: Amoril | last post by:
I've read quite a few different message on various boards and for some reason I'm still having trouble wrapping my head around this viewstate maintenance and trying to get these dynamically created...
5
by: developApps | last post by:
This problem only occurs in Firefox.... I have a page (page 1) with a link button. The link button uses response.redirect to pass parameters and take me to a second page (page 2) when the...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
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...
1
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...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.