Aktham Mahmoud

Aktham Mahmoud

  • NA
  • 720
  • 35k

What's wrong in modal popup (bootstarp)

Apr 21 2021 10:54 AM
Greeting
I designed a page containe detailsview and grideview, I play with show mood, a detailsview in (modal popup) conatier, when a user clich on (Add product) a modal popup woking correctly.
 Here a modal popup code for details view control in my work
  1. <script type="text/javascript">  
  2.         function ShowPopup(title, body) {  
  3.             $("#PopupCat .modal-title").html(title);  
  4.             $("#PopupCat .modal-body").html(body);  
  5.             $("#PopupCat").modal("show");  
  6.         }  
 
  1. <div class="modal fade" id="myModal" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">  
  2. div class="modal-dialog">  
  3. <div class="modal-content">  
  4.     <div class="modal-header">  
  5.         <table style="width:100%">  
  6.             <tr>  
  7.                 <td style="text-align:left">  
  8.         <h4 class="modal-title" style="text-decoration:wavy; color:#006699">Add Category</h4>  
  9.                 </td>  
  10.                 <td style="text-align:right">  
  11.                     <button type="button" class="close" data-dismiss="modal" aria-hidden="true" style="color:red">×</button>  
  12.                 </td>  
  13.             </tr>  
  14.         </table>  
  15.   
  16.     </div>  
  17.     <div class="modal-body" style="padding-left: 0px;padding-right:0px">  
  18.       <div class="col-lg-12" style="padding-left: 10px;padding-right:0px">  
  19.   
  20. sp:DetailsView ID="DV_ADDCAT" runat="server" AutoGenerateRows="False" DefaultMode="Insert" OnItemCommand="DV_ADDCAT_ItemCommand" OnModeChanging="DV_ADDCAT_ModeChanging">  
  21.     <Fields>  
  22.         <asp:TemplateField HeaderText="Cat.Code">  
  23.             <EditItemTemplate>  
  24.                 <asp:TextBox ID="Tb_CatCodeId" runat="server" Text=""></asp:TextBox>  
  25.             </EditItemTemplate>  
  26.         </asp:TemplateField>  
  27.         <asp:TemplateField HeaderText="Name" SortExpression="Name">  
  28.             <EditItemTemplate>  
  29.       
  30.             </EditItemTemplate>  
  31.             <InsertItemTemplate>  
  32.                 <asp:TextBox ID="TB_CatName_I" runat="server" Text="" ></asp:TextBox>  
  33.             </InsertItemTemplate>  
  34.             <ItemTemplate>  
  35.             
  36.             </ItemTemplate>  
  37.         </asp:TemplateField>  
  38.         <asp:TemplateField HeaderText="Description" SortExpression="Description">  
  39.             <EditItemTemplate>  
  40.                   
  41.             </EditItemTemplate>  
  42.             <InsertItemTemplate>  
  43.                 <asp:TextBox ID="TB_CDESC_I" runat="server" Text="" TextMode="MultiLine"></asp:TextBox>  
  44.             </InsertItemTemplate>  
  45.             <ItemTemplate>  
  46.          
  47.             </ItemTemplate>  
  48.         </asp:TemplateField>  
  49.             
  50.         <asp:TemplateField>  
  51.             <InsertItemTemplate>  
  52.                <div style="text-align:center">  
  53.             <asp:Button ID="Button1" runat="server" Text="Add"  CommandName="AddNew" CssClass="btn btn-outline-success" />  
  54.                 <asp:Button ID="Button2" runat="server" Text="Cancel" CommandName="Cancel" CssClass="btn btn-outline-dark"/>  
  55.                </div>  
  56.                    </InsertItemTemplate>  
  57.         </asp:TemplateField>  
  58.     </Fields>  
  59. </asp:DetailsView>  
  60.           </div>  
  61.     </div>  
  62.   </div>  
  63. </div>  
  64.     </div>  
 In a same way I play on delete row from grideview message, (when a user delete record) a modal popup show message like this photo which work correctly in another page
 
 
 But this method not working correctly in a page which i work on it which conatin another modal popup which conatine (deatils view control)
 here a code for delete row in Grideview which should show a modal popup message, notice a delete row working correctly no problem with that, my problem a popup message not working correctly
  1. <script type="text/javascript">  
  2. /for detailsview  
  3.        function ShowPopup(title, body) {  
  4.            $("#PopupCat .modal-title").html(title);  
  5.            $("#PopupCat .modal-body").html(body);  
  6.            $("#PopupCat").modal("show");  
  7.        }  
  8.   
  9. /for gridview  
  10.        function ShowPopupDcat(title, body) {  
  11.            $("#PopupCat .modal-title1").html(title);  
  12.            $("#PopupCat .modal-body1").html(body);  
  13.            $("#PopupCat").modal("show");  
  14.        }  
  15. lt;/script>  
event callback a modal popup in c# (Gridview RowCommand)
  1. if (e.CommandName == "Delete")  
  2.                 {  
  3.                     Label Lb_Ccode = (Label)GV_Category.Rows[rowidcat].FindControl("Lb_CoId_I");  
  4.                     Label Lb_Cname = (Label)GV_Category.Rows[rowidcat].FindControl("Lb_CatName");  
  5.                     Label Lb_imgCnm = (Label)GV_Category.Rows[rowidcat].FindControl("Lb_PhoName_I");  
  6.                     DelFromCatFolder(Lb_imgCnm.Text);  
  7.                     lbdcatinfo.Text = "Category Row" + " " + "[[" + Lb_Ccode.Text + "]]" + " " + "[[" + Lb_Cname.Text + "]]" + "deleted from Data Base";  
  8.                     imgdel.ImageUrl = "~/images/Forbidden_area/row_del.png";  
  9.                     ClientScript.RegisterStartupScript(this.GetType(), "Popup""ShowPopupDcat();"true);  
  10.                 }  
 Soooooooooooooo what's wrong in my work? Is this method wrong completly or I can't able to call two modal pop up in differnt ways.
many thanks