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

Can I place button Target Control ID outside the Update Panel of Modal Popup in asp.net?

$
0
0

I have a button inside grid view. What I want to do is to show a modal popup when I click that button.

Since, I cannot place the modal popup extender inside the gridview I am placing it outside of gridview. Because I am placing it outside the gridview the gridview button has no access to it. For this I created a dummy button outside the gridview and calling the modal popup from the click event of Gridview button.

Let me show you my Grid view(Its telerik)

<telerik:RadGrid ID="GridView2" runat="server" AutoGenerateColumns="false" Width="400"
                    GridLines="None" ><MasterTableView ><Columns><telerik:GridBoundColumn DataField="fname" HeaderText="First Name" /><telerik:GridBoundColumn DataField="mname" HeaderText="Middle Name" /><telerik:GridBoundColumn DataField="lname" HeaderText="Last Name" /><telerik:GridTemplateColumn><ItemTemplate><asp:CheckBox ID="checkselect" runat="server" /></ItemTemplate><HeaderTemplate><asp:Button ID="Button4" runat="server" Text="Remove"  CommandName="Split" OnClick="Button4_Click" /></HeaderTemplate></telerik:GridTemplateColumn></Columns></MasterTableView ></telerik:RadGrid></div></td></tr></ItemTemplate></telerik:GridTemplateColumn></Columns></MasterTableView></telerik:RadGrid>



Now my modal popup

<asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate><asp:Button ID="Button5" runat="server" Text="Button" style="display:none"/><asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="Button5" CancelControlID="Button1" PopupControlID="Panel1"></asp:ModalPopupExtender><asp:Panel ID="Panel1" runat="server" Height="65px" style="display:none" ><p>
    Thank You for Removing records</p></asp:TextBox> <asp:Button ID="Button3" runat="server" Text="Submit"  /><asp:Button ID="Button1" runat="server" Text="Cancel" /></asp:Panel></ContentTemplate></asp:UpdatePanel>

The problem is when I am clicking the gridview button( Button4) it is throwing me Invalid Postback error. I think thats because I am placing the Modalpopup inside update panel and gridview outside. Can someone tell me how to deal with this issue? I cannot place the Gridview inside the update panel because it is stopping the button click event which is causing the modal popup extender to show.

I would truly appreciate if someone can tell me how to deal with this problem? Also, I tried without updatepanel but it still gives me Invalid Post Back Error. 

Button Click Event:

protectedvoidButton4_Click(object sender,EventArgs e){ModalPopupExtender1.Show();}

Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>