0
Reply

ajax ModalPopupExtender problem

Ask a question
Dipa Ahuja

Dipa Ahuja

14y
4.3k
1
hello..
i want to use ModalPopupExtender control of ajax when user clicks on "change image" link..

i have used this way...

<asp:HyperLink ID="EditImage"  CssClass="hp" Text="Change Image" runat="server" />

<cc1:ModalPopupExtender ID="ModalPopupExtender" runat="server" 
           TargetControlID="EditImage"
           PopupControlID="pnlUimage" 
           OkControlID="OkButton"           
           CancelControlID="CancelButton" 
           BackgroundCssClass="modalBackground" />


on  PopupControlID="pnlUimage"  panel i have put details view control
and by clicking on update it changes the detailsview mode to editmode


<asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="500px" 
AutoGenerateRows="False" GridLines="Horizontal" BorderWidth="1" DataSourceID="SqlDataSource1">       
        <Fields>                
           
        <asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="" SortExpression="pimage">
                <EditItemTemplate>
                    <asp:ImageButton ImageAlign="Middle" Height="140" Width="110"
                     ID="ImageButton1" ImageUrl='<%# Eval("pimage","user_image/{0}") %>'
                      runat="server" /><br />
                  <asp:TextBox Visible="false" runat="server" Text='<%# Eval("pimage","user_image/{0}") %>'
                   id="txtPictureURL"/><br /><br />
                   <asp:Label runat="server" ID="myThrobber" style="display:none;"></asp:Label>
                                    <br />      
                  <asp:FileUpload ForeColor="black" ID="FileUpload1" Runat="server" /><br />
                 <asp:Button ID="btnUpload" Runat="server" Text="Upload Picture" 
                 OnClick="btnUpload_Click"
                 Width="127px" Height="21px" />
              <asp:Label ID="Status" Runat="server"></asp:Label>   
                </EditItemTemplate>                
                <ItemTemplate>
                    <asp:ImageButton Height="140" Width="110" ID="ImageButton1" ImageUrl='<%# Eval("pimage","user_image/{0}") %>'
                     runat="server" />
                </ItemTemplate>
            </asp:TemplateField>
<%--            <asp:BoundField DataField="fname" HeaderText="" ReadOnly="true" SortExpression="fname" />
            <asp:BoundField DataField="lname" HeaderText="" ReadOnly="true"  SortExpression="lname" />
--%>        </Fields>
          <CommandRowStyle HorizontalAlign="Right" />    
    
    </asp:DetailsView>
<asp:Button ID="OkButton" runat="server" Text="OK" />
 <asp:Button ID="CancelButton" runat="server" Text="Cancel" />

   
i want that when it pops up, the user can change his/her profile image and when click on OK button the pop up should be disappear...

bt in this case when i click on "Change image" Link the popup appears and when i click on "update" of details view the pop up disappear..