Solved

Linkbutton Inside Gridview Not Firing Server Side Code

Posted on 2009-07-15
2
481 Views
Last Modified: 2012-05-07
Please see me code below.

I've debugged and set a breakpoint on the  gvProds_RowCommand subroutine and it's not hitting it.

Any ideas?
<asp:GridView ID="gvProds" runat="server" BackColor="#EEEEEE" GridLines="horizontal" AllowSorting="false" CssClass="TextLabel" Width="780px"
AutoGenerateColumns="false" DataKeyNames="key" EnableViewState="false" >
<SelectedRowStyle BackColor="LightYellow" Font-Bold="true" />
<HeaderStyle BackColor="LightSlateGray" ForeColor="White" />
<AlternatingRowStyle BackColor="#DDDDDD" Font-Bold="false" />
<RowStyle Font-Bold="false" />                                
<Columns>                                                                        
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="lnkDetails" runat="server" Text="Details." CommandArgument='<%# eval("key") %>' CommandName="select" CausesValidation="false">								  </asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>                                                        
</asp:GridView>
 
                       
 
 
 
    Protected Sub gvProds_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles gvProds.RowCommand
 
        If e.CommandName = "select" Then
            Me.hdnSelectedItem.Value = CType(sender, GridView).DataKeys(e.CommandArgument).Value
            SetMenuOptions(1)
        End If
 
    End Sub

Open in new window

0
Comment
Question by:synapse88
2 Comments
 
LVL 11

Accepted Solution

by:
b_levitt earned 500 total points
ID: 24862738
you could try wiring the even in the tag:
<asp:GridView onrowcommand="gvProds_RowCommand"...

Are you binding the grid without a if(!IsPostBack) check?  If so try that or bind the grid in prerender instead.

ViewState turned off somewhere?
0
 

Author Comment

by:synapse88
ID: 24863420
It was view state, thanks!
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
daypilot scheduler 3 26
Why does my excel data start at B1 instead of A1. 9 80
Moving code from one TFS branch to another 3 25
Linq asp.net mvc 13 6
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question