I am able to retrieve the pcodes in a datalist: this is the cart.aspx file code <pre lang="c#"><![CDATA[<%@ Page Title="E-Cart" Language="C#" MasterPageFile="~/shopmaster.master" AutoEventWireup="true" CodeFile="Cart.aspx.cs" Inherits="Cart" %>]]> <asp:content id="Content1" contentplaceholderid="head" runat="Server" xmlns:asp="#unknown"> <style type="text/css"> .style45 {} .style46 { width: 66%; height: 105px; } .style49 {} .style50 { width: 698px; } </style> </asp:content> <asp:content id="Content2" contentplaceholderid="ContentPlaceHolder1" runat="Server" xmlns:asp="#unknown"> <asp:panel id="Panel4" runat="server" cssclass="style45" height="302px"> <table class="style46"> <tr valign="top"> <br /> <asp:datalist id="DataList1" runat="server"> <itemtemplate> PCode: <asp:label id="Label_pcode" runat="server" text="<%#Eval("pcode")%>"></asp:label> </itemtemplate> </asp:datalist> <br /> <asp:label id="Label1" runat="server" text="Label"></asp:label> <td valign="top"> <asp:button id="Button_AddMore" runat="server" cssclass="style49" height="34px"> onclick="Button_AddMore_Click" Text="Add More Items" Width="143px" /> <br /> <asp:button id="Button_AddMore0" runat="server" cssclass="style49"> Height="34px" onclick="Button_AddMore_Click" Text="Proceed to Payment" Width="143px" /> </asp:button></asp:button></td> </tr> </table> <br /> </asp:panel> </asp:content> </pre> this is the Cart.aspx.cs file code <pre lang="c#">using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Collections; using System.Data; public partial class Cart : System.Web.UI.Page { Classdataconn con = new Classdataconn(); DataTable dt1 = new DataTable(); protected void Page_Load(object sender, EventArgs e) { dt1.Columns.Add("pcode"); if (Session["sess_pcodes"] != null) { dt1.Clear(); dt1 = (DataTable)Session["sess_pcodes"]; BindData(dt1); } } protected void BindData(DataTable dt) { DataList1.DataSource = dt1; DataList1.DataBind(); } protected void Button_AddMore_Click(object sender, EventArgs e) { Response.Redirect("products.aspx"); } }</pre> I want to get the corresponding rows from the database against those pcode in the datalist.. Kindly help.. :( :(
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Data; using System.Data.SqlClient; using System.Configuration; /// <summary> /// Summary description for Classdataconn /// </summary> public class Classdataconn { SqlConnection con; public Classdataconn() { // // TODO: Add constructor logic here // } public SqlConnection conn_connect() { con = new SqlConnection(ConfigurationManager.ConnectionStrings["connection"].ToString()); return con; } public void INUPDL(string st) { SqlCommand com = new SqlCommand(); com.Connection = conn_connect(); com.CommandText = st; con.Open(); com.ExecuteNonQuery(); con.Close(); } public DataSet data_Fetch(string ss) { SqlDataAdapter adpt = new SqlDataAdapter(ss, conn_connect()); DataSet ds = new DataSet(); adpt.Fill(ds); return ds; } }
data_Fetch
INUPDL
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)