Skip to content
Loading
Open Another page In bootstrap modal popup    
  •                     
  •                 
  •             
  •    
  • (2) userbasket.aspx c# code
    1. using System;    
    2. using System.Collections.Generic;    
    3. using System.Linq;    
    4. using System.Web;    
    5. using System.Web.UI;    
    6. using System.Web.UI.WebControls;    
    7. using System.Data;    
    8. using System.Data.SqlClient;    
    9. using System.Web.Configuration;    
    10. using System.Web.Security;    
    11.     
    12. namespace WebApplication1    
    13. {    
    14.     public partial class userbaasket : System.Web.UI.Page    
    15.     {    
    16.         protected void Page_Load(object sender, EventArgs e)    
    17.         {    
    18.             if (!IsPostBack)    
    19.             {    
    20.                 DataTable dt = new DataTable();    
    21.                 DataRow dr;    
    22.                 dt.Columns.Add("Id");    
    23.                 dt.Columns.Add("Pro_CodeId");    
    24.                 dt.Columns.Add("P_Name");    
    25.                 dt.Columns.Add("P_Price");    
    26.                 dt.Columns.Add("cost");    
    27.                 dt.Columns.Add("totalcost");    
    28.     
    29.                 if (Request.QueryString["id"] != null)    
    30.                 {    
    31.                     if (Session["bskitems"] == null)    
    32.                     {    
    33.     
    34.                         dr = dt.NewRow();    
    35.                         //String mycon = "Data Source=HP-PC\\SQLEXPRESS;Initial Catalog=haritiShopping;Integrated Security=True";    
    36.                         string mycon = @"Data Source=(local)\SQLEXPRESS;AttachDbFilename=|DataDirectory|\DbCh.mdf;Integrated Security=True";    
    37.     
    38.                         SqlConnection scon = new SqlConnection(mycon);    
    39.                         String myquery = "select * from Products where Id=" + Request.QueryString["id"];    
    40.                         SqlCommand cmd = new SqlCommand();    
    41.                         cmd.CommandText = myquery;    
    42.                         cmd.Connection = scon;    
    43.                         SqlDataAdapter da = new SqlDataAdapter();    
    44.                         da.SelectCommand = cmd;    
    45.                         DataSet ds = new DataSet();    
    46.                         da.Fill(ds);    
    47.                         dr["Id"] = 1;    
    48.                         dr["Pro_CodeId"] = ds.Tables[0].Rows[0]["Pro_CodeId"].ToString();    
    49.                         dr["P_Name"] = ds.Tables[0].Rows[0]["P_Name"].ToString();    
    50.                         dr["P_Price"] = ds.Tables[0].Rows[0]["P_Price"].ToString();    
    51.                         dt.Rows.Add(dr);    
    52.                         Gvusrbasket.DataSource = dt;    
    53.                         Gvusrbasket.DataBind();    
    54.                         Session["bskitems"] = dt;    
    55.                     }    
    56.                     else    
    57.                     {    
    58.     
    59.                         dt = (DataTable)Session["bskitems"];    
    60.                         int sr;    
    61.                         sr = dt.Rows.Count;    
    62.     
    63.                         dr = dt.NewRow();    
    64.                         string mycon = @"Data Source=(local)\SQLEXPRESS;AttachDbFilename=|DataDirectory|\DbCh.mdf;Integrated Security=True";    
    65.                         SqlConnection scon = new SqlConnection(mycon);    
    66.                         String myquery = "select * from Products where Id=" + Request.QueryString["id"];    
    67.                         SqlCommand cmd = new SqlCommand();    
    68.                         cmd.CommandText = myquery;    
    69.                         cmd.Connection = scon;    
    70.                         SqlDataAdapter da = new SqlDataAdapter();    
    71.                         da.SelectCommand = cmd;    
    72.                         DataSet ds = new DataSet();    
    73.                         da.Fill(ds);    
    74.                         dr["Id"] = sr + 1;    
    75.                         dr["Pro_CodeId"] = ds.Tables[0].Rows[0]["Pro_CodeId"].ToString();    
    76.                         dr["P_Name"] = ds.Tables[0].Rows[0]["P_Name"].ToString();    
    77.                         dr["P_Price"] = ds.Tables[0].Rows[0]["P_Price"].ToString();    
    78.                         dt.Rows.Add(dr);    
    79.                         Gvusrbasket.DataSource = dt;    
    80.                         Gvusrbasket.DataBind();    
    81.                         Session["bskitems"] = dt;    
    82.     
    83.                     }    
    84.                 }    
    85.                 else    
    86.                 {    
    87.                     dt = (DataTable)Session["bskitems"];    
    88.                     Gvusrbasket.DataSource = dt;    
    89.                     Gvusrbasket.DataBind();    
    90.     
    91.                 }    
    92.             }    
    93.         }    
    94.     }    
    95. }  
    (3) Products page
    1. "ListView1" runat="server" DataSourceID="SDS_Pro" DataKeyNames="Id" GroupItemCount="4" GroupPlaceholderID="groupPlaceHolder1" ItemPlaceholderID="itemPlaceHolder1" OnItemCommand="ListView1_ItemCommand">    
    2.          
    3.                 "Table1" runat="server" style="">    
    4.                         
    5.                         "color:red; font-size:medium">Sorry! No Products avialabe in selected Category to show it, Maybe under price modifying Or update Content..

      "server" ID="HYBback" Text="Back To Categories Page" NavigateUrl="~/categories.aspx" CssClass="btn-outline-warning">       
    6.                     
    7.                         
    8.                     
    9.                 
    10.                 
    11.                 class="row text-center">    
    12.                     "server" ID="groupPlaceHolder1">    
    13.                 
        
  •                 
  •                 
  •                 class="row text-center screenwidth">    
  •                     "server" ID="itemPlaceHolder1">    
  •                     
  •                 
  •         
  •                              class="col-lg-3 d-flex align-items-stretch">      
  •                         class="card">      
  •                             class="card-header" style="font-size:x-large;color:brown">      
  •                                 "Label3" runat="server" Text='<%#Eval("P_Name")%>'>      
  •                                   
  •                             class="card-body">      
  •                                 "Image1"  runat="server" ImageUrl='<%#Eval("P_photo") %>'  class="rounded-circle" Height="100%" Width="100%"/>      
  •                                 Product Code:  <%# Eval("Pro_CodeId") %>      
  •                                 class="dsc"><%#Eval("Ingredients") %>

        
  •                                      
  •                                 Price:    
  •                                 "Label1" runat="server" Text='<%# Eval("P_Price") %>' />    
  •                                 Quatity:  "DDR_Q" runat="server" CssClass="dropdown-menu">    
  •                          1    
  •                           2    
  •                            3    
  •                           4    
  •                                     5    
  •                           6    
  •                                     7    
  •                           8    
  •                                     9    
  •                           10    
  •                                           
  •                                   
  •                             class="card-footer">      
  •                     "LinkButton1" runat="server" Text="Order Me :)" CommandName="addtocart" CommandArgument='<%#Eval("Id") %>' >           
  •     
  •                                        
  •                               
  •                       
  •        
  •   
  • As you can see
     
     
    So how to add
     
    href="#myModal" data-toggle="modal"
     
    Like that sample
     
    Open Another Gridview in Pop-up using Bootstrap Modal Pop-up
     
    https://www.c-sharpcorner.com/UploadFile/77a82c/open-another-gridview-in-pop-up-using-bootstrap-modal-pop-up/
     
    Nothing success with me,,
     
    any help please
    Thanks

    1 Reply

    Know the answer? Post it — somebody with the same question will find it here.