Search code examples
c#asp.net-ajaxajaxcontroltoolkitmodalpopupextender

Populate values in pop up from the grid in asp.net


    <asp:GridView ID="UserTable" runat="server" AllowPaging="False" SelectedIndex="0"   DataKeyNames="UserID" ShowHeaderWhenEmpty="True"
                            OnRowDeleting="UserTable_RowDeleting" AutoGenerateColumns="false">
    <Columns>
    <asp:TemplateField HeaderText="Edit Controls" ItemStyle-Width="15%">
    <ItemTemplate>
    <%--  <asp:LinkButton ID="lnk_Edit" ToolTip="Edit User" CommandArgument='<%# Eval("UserID") %>' CommandName="Edit1" runat="server">--%>
    <asp:ImageButton ID="img_Edit"  src="Styles/Images/Edit.jpg" runat="server"           style="border-style: none" CommandArgument='<%# Eval("UserID") %>'
                                    CommandName="Edit1"  />
<%--</asp:LinkButton>--%>
    <asp:PopupControlExtender ID="PopUCtrlExt_Edit" runat="server" DynamicServicePath=""
                                            Enabled="True" ExtenderControlID="" TargetControlID="img_Edit" PopupControlID="pnl_updateUser">
    </asp:PopupControlExtender>

I wanted to get a pop up when I click the edit image inside my grid view. When I tried with a edit image inside a link the pop up was doing post back so I had to remove the link. Now How can i get the values of the selected row and use that value in the pop up panel which has

<asp:ListBox ID="listboxE_RoleName" runat="server" DataSourceID="SurelyKnown" DataTextField="RoleName" DataValueField="RoleName"></asp:ListBox>
<asp:TextBox ID="txtE_Email" runat="server" CssClass="style23"></asp:TextBox>

I want to edit the selected value. How to populate the values of selected row in the pop up panel in client side. If possible also a fix for the pop up postback when I use the image button inside the link. Thanks


Solution

  • Check these links

    http://mattberseth.com/blog/2007/07/modalpopupextender_example_for.html

    http://mattberseth.com/blog/2008/06/masterdetail_with_the_gridview_1.html

    http://mattberseth.com/blog/2008/04/masterdetail_with_the_gridview.html

    http://www.aspdotnet-suresh.com/2011/03/how-to-show-modalpopup-to-edit-gridview.html