Krunal Sisodiya
Krunal Sisodiya

Reputation: 11

The TargetControlID of 'ModalPopupExtender1' is not valid. A control with ID 'lbview' could not be found

<asp:GridView ID="gvstudent" AutoGenerateColumns="false" runat="server" OnRowCommand="gvstudent_RowCommand">
    <Columns>
        <asp:BoundField DataField="FName" HeaderText="Name" />
        <asp:BoundField DataField="LName" HeaderText="Surname" />
        <asp:BoundField DataField="Email" HeaderText="Email" />
        <asp:BoundField DataField="Technology" HeaderText="Technology" />
        <asp:TemplateField>
            <ItemTemplate>
                <asp:LinkButton ID="lbview" CommandName="cmdView" CommandArgument='<%#Eval("ID") %>' runat="server">View</asp:LinkButton>
                <asp:LinkButton ID="lbDelete" CommandName="cmdDelete" CommandArgument='<%#Eval("ID") %>' runat="server">Delete</asp:LinkButton>
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
</asp:GridView>

Upvotes: 1

Views: 3272

Answers (1)

rdmptn
rdmptn

Reputation: 5601

The lbview link button is in an item template, so its ID changes when the gridview data binds, it would be something like gvstudent_ctl00_lbview in the end

Consider using the client-API of the MPE: $find("<%=theModalPopupExtenderID.ClientID%>").show() and call that from the client click o nthe lbview. And, do not forget to cancel the postback.

Or, take a look here for a similar scenario that uses JS: http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandwindow/defaultcs.aspx?product=window.

Upvotes: 2

Related Questions