Click here to Skip to main content
15,904,346 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: How Attach Multiple Files Pin
lrsalunkhe9-Nov-09 17:54
lrsalunkhe9-Nov-09 17:54 
GeneralRe: How Attach Multiple Files Pin
lrsalunkhe9-Nov-09 20:33
lrsalunkhe9-Nov-09 20:33 
GeneralRe: How Attach Multiple Files Pin
Gamzun10-Nov-09 3:44
Gamzun10-Nov-09 3:44 
QuestionNeed suggestion either Website or web service Pin
jaiswalrahul9-Nov-09 1:13
jaiswalrahul9-Nov-09 1:13 
AnswerRe: Need suggestion either Website or web service Pin
Nishant Singh9-Nov-09 1:27
Nishant Singh9-Nov-09 1:27 
Questiondatatable... Pin
mylogics9-Nov-09 0:49
professionalmylogics9-Nov-09 0:49 
AnswerRe: datatable... Pin
Nishant Singh9-Nov-09 1:16
Nishant Singh9-Nov-09 1:16 
GeneralRe: datatable... Pin
mylogics9-Nov-09 1:26
professionalmylogics9-Nov-09 1:26 
this is the page wr my cart is shown name cart.aspx....
public partial class mycart : System.Web.UI.Page
{
    DataTable dt =new DataTable(); 
       
    DataView cartview; 
    protected void Page_Load(object sender, EventArgs e)
    {
        Getsource();      
        if(!IsPostBack)
        {
            Bindlist();
        }
        //DataList1.DataSource = dt;
        //DataList1.DataBind();
        //Session["cart"] = dt;
        //cartview.Sort = "ProductName";
    }
    void Bindlist()
    {
        DataList1.DataSource = cartview;
        DataList1.DataBind();
        Session["cart"] = dt;
    }
    void Getsource()
    {
        
        dt = (DataTable)Session["cart"];
        cartview = new DataView(dt);
        return;
        //cartview.Sort = "ProductName";
        //Session["cart"] = dt;
    }
    
    protected void Update(object source, DataListCommandEventArgs e)
    {
        int ProductID = Convert.ToInt32(DataList1.DataKeys[e.Item.ItemIndex]);
        TextBox txtqty;
        txtqty = ((TextBox)e.Item.FindControl("txtqty"));
        string connectionstring = ConfigurationManager.ConnectionStrings["SilverOnline"].ConnectionString;
        SqlConnection conn = new SqlConnection(connectionstring);
        SqlCommand cmd = new SqlCommand("Update Home Set ProductQty=@productqty Where ProductID=@productid", conn);
        cmd.Parameters.Add("@productqty", SqlDbType.VarChar).Value = txtqty.Text;
        cmd.Parameters.Add("@productid", SqlDbType.Int).Value = ProductID;
        if (conn.State == ConnectionState.Closed)
            conn.Open();
        cmd.ExecuteNonQuery();
        if (conn.State == ConnectionState.Open)
            conn.Close();
        DataList1.EditItemIndex = -1;
        Bindlist();
        
    }
    protected void Delete(object source, DataListCommandEventArgs e)
    {
        string name = ((Label)e.Item.FindControl("Label1")).Text;
        cartview.RowFilter = "ProductName='" + name + "'";
        if (cartview.Count > 0)
        {
            cartview.Delete(0);
        }
        cartview.RowFilter = "";
        DataList1.EditItemIndex = -1;
        Bindlist();
    }
}

on my addcart.aspx page m adding that particular product to cart....the code is...
protected void Button1_Click(object sender, EventArgs e)
    {
        DataList1.Visible = false;
        Button1.Visible = false;
        GridView1.Visible = true;

       
        string str = Request.QueryString["ProductID"];
        int i = Convert.ToInt16(str);
        SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["SilverOnline"].ConnectionString);
        string str1 = "Select * From Home Where(ProductID='" + str + "')";
        SqlCommand cmd = new SqlCommand(str1, conn);
        SqlDataReader dr = null;
        conn.Open();
        dr = cmd.ExecuteReader();
        DataTable dt = new DataTable();
        while (dr.Read())
        {

            dt.Columns.Add("ProductID", typeof(int));
            dt.Columns["ProductID"].AutoIncrement = true;
            dt.Columns["ProductID"].AutoIncrementSeed = 100;
            dt.Columns.Add("ProductName", typeof(string));
            dt.Columns.Add("ProductImg", typeof(string));
            dt.Columns.Add("ProductPrice", typeof(string));
            dt.Columns.Add("ProductQty", typeof(string));

            DataRow row = dt.NewRow();
            row["ProductName"] = dr["ProductName"].ToString();
            row["ProductImg"] = dr["ProductImg"].ToString();
            row["ProductPrice"] = dr["ProductPrice"].ToString();
            row["ProductQty"] = 1;
            dt.Rows.Add(row);
            Session["cart"] = dt;
            //GridView1.DataSource = Session["cart"];
            //GridView1.DataBind();

        }
        conn.Close();
        Response.Redirect("mycart.aspx");
        
    }

GeneralRe: datatable... Pin
Nishant Singh9-Nov-09 1:40
Nishant Singh9-Nov-09 1:40 
GeneralRe: datatable... Pin
Nishant Singh9-Nov-09 1:43
Nishant Singh9-Nov-09 1:43 
GeneralRe: datatable... Pin
Greg Chelstowski9-Nov-09 1:49
Greg Chelstowski9-Nov-09 1:49 
QuestionRun a video clip in asp.net stored in database Pin
gautamamit88-Nov-09 23:24
gautamamit88-Nov-09 23:24 
AnswerRe: Run a video clip in asp.net stored in database Pin
Christian Graus8-Nov-09 23:30
protectorChristian Graus8-Nov-09 23:30 
GeneralRe: Run a video clip in asp.net stored in database Pin
gautamamit88-Nov-09 23:41
gautamamit88-Nov-09 23:41 
QuestionWeb Application Pin
Swati_g19858-Nov-09 23:24
Swati_g19858-Nov-09 23:24 
AnswerRe: Web Application Pin
Christian Graus8-Nov-09 23:29
protectorChristian Graus8-Nov-09 23:29 
GeneralRe: Web Application Pin
Swati_g19858-Nov-09 23:43
Swati_g19858-Nov-09 23:43 
GeneralRe: Web Application Pin
sashidhar9-Nov-09 0:13
sashidhar9-Nov-09 0:13 
QuestionRedirect from one page of a one project to another page of another project in same solution Pin
getaccessyr8-Nov-09 23:24
getaccessyr8-Nov-09 23:24 
AnswerRe: Redirect from one page of a one project to another page of another project in same solution Pin
Nishant Singh8-Nov-09 23:26
Nishant Singh8-Nov-09 23:26 
AnswerRe: Redirect from one page of a one project to another page of another project in same solution Pin
padmanabhan N8-Nov-09 23:30
padmanabhan N8-Nov-09 23:30 
GeneralRe: Redirect from one page of a one project to another page of another project in same solution Pin
getaccessyr8-Nov-09 23:36
getaccessyr8-Nov-09 23:36 
Questiontotal and subtotal in gridview footer Pin
RajpootRohan8-Nov-09 23:08
professionalRajpootRohan8-Nov-09 23:08 
AnswerRe: total and subtotal in gridview footer Pin
Nishant Singh8-Nov-09 23:38
Nishant Singh8-Nov-09 23:38 
GeneralRe: total and subtotal in gridview footer Pin
RajpootRohan9-Nov-09 0:21
professionalRajpootRohan9-Nov-09 0:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.