Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Linkbutton Rowcommand (and OnClick) events not firing from gridview in update panel

$
0
0

I have a gridview inside an update panel.  Associated with the page are two user controls.  The first is a modal popup that allows the user to enter a new item that should be displayed in the list located within the grid.  The second is a modal popup that will display the details of an item listed in the grid - and should be displayed when the user clicks the linkbutton on that item's row.  I intend to display the model popup programmatically by trapping the linkbutton and determieng the proper arguments.

The gridview is being populated (databind) from the gridview prerender event.  I am NOT testing for postback there as the grid will not be re-displayed properly when the first popup is closed if I do that.

So, is there anyway to make this work correctly?

Here is the appropriate section from the .asp page:

<asp:UpdatePanel runat="server" ID="updpnlDisplayList" UpdateMode="Conditional" ><ContentTemplate><asp:GridView ID="gvPersonEvents" runat="server" AutoGenerateColumns="False"
				ShowHeader="False" Width="495px" CssClass="grviewstyle"
				CellPadding="1" AllowPaging="True"
				EmptyDataText="&nbsp;No (matching) events have been found." OnRowCommand="gvPersonEvents_RowCommand"><AlternatingRowStyle BackColor="LightGray" /><Columns><asp:TemplateField><ItemStyle Width="70px" CssClass="gridViewColumn" /><ItemTemplate><asp:TextBox runat="server" ID="txtEventDate"
								ToolTip = '<%# String.Format("{0:MM/dd/yyyy hh:mm:ss tt}",DataBinder.Eval(Container.DataItem, "EventDate")) %>'
								Text='<%# String.Format("{0:MM/dd/yyyy}",DataBinder.Eval(Container.DataItem, "EventDate")) %>'
								CssClass="gridTextField" Width="70px"  /></ItemTemplate></asp:TemplateField><asp:TemplateField HeaderText="Type" ><ItemStyle CssClass="gridViewColumn" /><ItemTemplate><asp:LinkButton CssClass="linkNoOverFlowForGrid" runat="server" ID="lbEventTypeDescription"
                                        CommanName="View" CausesValidation="False"
                                        CommandArgument='<%# DataBinder.Eval(Container.DataItem, "ID") %>'
                                        Text='<%# DataBinder.Eval(Container.DataItem, "Description") %>'
										ToolTip = '<%# DataBinder.Eval(Container.DataItem, "Notes") %>' /><asp:Button ID="btnTestClick" runat="server" CommandName="View" Text="test" OnClick="lnkbtnEventDescription_Click" CausesValidation="False" /></ItemTemplate></asp:TemplateField><asp:TemplateField ><ItemStyle Width="20px" CssClass="gridViewColumn" HorizontalAlign="Center" /><ItemTemplate><asp:Image runat="server" ID="imgInfo1" ToolTip='<%# DataBinder.Eval(Container.DataItem, "Information") %>'
								ImageAlign="Right" ImageUrl="../images/infologo.gif" /></ItemTemplate></asp:TemplateField></Columns></asp:GridView></ContentTemplate></asp:UpdatePanel>

And then the code from the code behind:

    Private Sub gvPersonEvents_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles gvPersonEvents.PreRender
        Dim debug As String = "debug"
        'This code loads the first page of events, during partial post-backs, 
        'when the Page_Load method is not called on the parent page or on the control.
        If (gvPersonEvents.DataSource Is Nothing) Then
            Dim pageIndex As Integer
            pageIndex = 0
            Me.LoadEntityEvents(pageIndex)
        End If
        updpnlDisplayList.Update()
    End Sub
    Protected Sub lnkbtnEventDescription_Click(ByVal sender As Object, ByVal e As EventArgs)
        Dim lnkAddr As LinkButton = CType(sender, LinkButton)
        EventDetails.SetupEventDetails(CInt(lnkAddr.CommandArgument))
    End Sub

    Protected Sub gvPersonEvents_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles gvPersonEvents.RowCommand
        If e.CommandName = "View" Then
            Dim I As Integer
            I = CInt(e.CommandArgument)
        End If

    End Sub

 


Viewing all articles
Browse latest Browse all 5678

Trending Articles