1 Replies - 439 Views - Last Post: 20 January 2012 - 03:40 PM Rate Topic: ***** 1 Votes

Topic Sponsor:

#1 chintan_1671  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 46
  • Joined: 22-December 08

ModalPopupExtender doesn't recognize TargetControlID

Posted 19 January 2012 - 10:00 AM

I am getting an error when i call the button id which is inside GridView Item template.

Error: "The TargetControlID of 'mpueResend' is not valid. A control with ID 'btnResend' could not be found."

Code:
<asp:GridView ID="GridMultiD" runat="server" CellPadding="3" 
                        AlternatingRowStyle-BackColor="#EDF3F7" HeaderStyle-CssClass="gridbgheading" 
                        Width="100%" HeaderStyle-HorizontalAlign="Center" >
                        
                    
                    <Columns>
                        <asp:TemplateField HeaderText="Resend">
                            <ItemStyle HorizontalAlign="Center" />
                                <ItemTemplate>
                                    <asp:Button ID="btnResend" runat="server" Text="Resend" CssClass="text ButtonInline"  />
                                </ItemTemplate>
                        </asp:TemplateField>
                        </Columns>
                        
                    </asp:GridView>




<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:ModalPopupExtender ID="mpueResend" runat="server" TargetControlID="btnResend" PopupControlID="pnlPopupResend" 
        BackgroundCssClass="modalBackGround" DropShadow="true" CancelControlID="btnCancelR" >
    </asp:ModalPopupExtender>



Please let me know if there is any solution for this.

Thank You.

Is This A Good Question/Topic? 0
  • +

Replies To: ModalPopupExtender doesn't recognize TargetControlID

#2 chintan_1671  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 46
  • Joined: 22-December 08

Re: ModalPopupExtender doesn't recognize TargetControlID

Posted 20 January 2012 - 03:40 PM

Nevermind .. i solved it.

Added a dummy hidden field for ModalPopUp in aspx page and in code behind added ModalPopup.show().

<asp:HiddenField ID="hfHidden" runat="server />
<asp:ModalPopupExtender ID="mpueResend" runat="server" TargetControlID="hfHidden" PopupControlID="pnlPopupResend" 
        BackgroundCssClass="modalBackGround" DropShadow="true" CancelControlID="btnCancelR" />
 
<asp:GridView ID="GridMultiD" runat="server" CellPadding="3" AlternatingRowStyle-BackColor="#EDF3F7" HeaderStyle-CssClass="gridbgheading" Width="100%" HeaderStyle-HorizontalAlign="Center" OnRowCommand="GridMultiD_RowCommand">  
    <Columns>
        <asp:TemplateField HeaderText="Resend">
            <ItemStyle HorizontalAlign="Center" />
            <ItemTemplate>
                 <asp:Button ID="btnResend" runat="server" Text="Resend" CssClass="text ButtonInline"  CommandName="ViewComments" />
            </ItemTemplate>
        </asp:TemplateField>
    </Columns> 
</asp:GridView>




protected void GridMultiD_RowCommand(object sender, GridViewCommandEventArgs e)
{
    switch (e.CommandName) // check the incoming command name
    {
        case "ViewComments":
            mpueResend.Show();
            break;
    }        
}



Thank You.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1