Click here to Skip to main content
15,905,875 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: GridView Rowcommand Problem Pin
_AK_13-Jan-09 23:11
_AK_13-Jan-09 23:11 
AnswerRe: GridView Rowcommand Problem Pin
anada888613-Jan-09 23:16
anada888613-Jan-09 23:16 
QuestionDataColumn.Ordinal is -1 when running my app on one webbserver Pin
anderslundsgard13-Jan-09 21:33
anderslundsgard13-Jan-09 21:33 
AnswerRe: DataColumn.Ordinal is -1 when running my app on one webbserver Pin
Paddy Boyd13-Jan-09 23:03
Paddy Boyd13-Jan-09 23:03 
GeneralRe: DataColumn.Ordinal is -1 when running my app on one webbserver Pin
anderslundsgard17-Jan-09 6:38
anderslundsgard17-Jan-09 6:38 
QuestionAccess Denied to pdf Pin
IamAmit13-Jan-09 21:22
IamAmit13-Jan-09 21:22 
AnswerRe: Access Denied to pdf Pin
Colin Angus Mackay13-Jan-09 22:57
Colin Angus Mackay13-Jan-09 22:57 
Questionunable to update datagrid! Pin
RajpootRohan13-Jan-09 21:19
professionalRajpootRohan13-Jan-09 21:19 
Hi to all,

I have a problem in updating the datagrid.

The scenerio is: I am having a datagrid on my page.I am basically working on shopping cart.Whenever user selects any the product it should be displayed in the datagrid(ie my cart).Suppose the user continues the shopping and he again selects one of the product.Then it should be added below the first row in the datagrid.

But I am not getting this result.Whenever I add another item in my cart ,it will replace the previous one.

I have tried it as:
protected void Page_Load(object sender, EventArgs e)

{

if (Session["Cart"] == null)

{

get_data();

Session["Cart"] = dt;

}

else

{

dt = (DataTable)Session["Cart"];

get_data();

// Session["Cart"] = Session["Cart"] + dt;


}

}

public void get_data()

{

dt = new DataTable();

dt.Columns.Add("REF", typeof(string));

dt.Columns.Add("Description", typeof(string));

dt.Columns.Add("QTY", typeof(int));

dt.Columns.Add("Price", typeof(float));

dt.Columns.Add("Cost", typeof(float));

pro_id = Request.QueryString["pr_id"];

quanti = Convert.ToInt32(Request.QueryString["quant"]);

SqlConnection con = new SqlConnection("Server=.; Database=eclsc; Trusted_Connection=yes");

SqlCommand cmd = new SqlCommand();

cmd.Connection = con;

cmd.CommandText = "select ICEMACHINES.product_id,ICEMACHINES.sh_desc,ICEMACHINES.price from ICEMACHINES where ICEMACHINES.product_id LIKE @product_id union select GLASSWARE.product_id,GLASSWARE.sh_desc,GLASSWARE.price from GLASSWARE where GLASSWARE.product_id LIKE @product_id ";

cmd.Parameters.Add("@product_id", SqlDbType.NVarChar, 50).Value = pro_id;

cmd.Connection.Open();

SqlDataReader rdr = cmd.ExecuteReader();

ArrayList arRole1 = new ArrayList();

while (rdr.Read())

{

desc = (rdr["sh_desc"]).ToString();

id = (rdr["product_id"]).ToString();

unitprice = Convert.ToSingle((rdr["price"]));

cost = unitprice * quanti;

arRole1.Add(rdr["product_id"]);

arRole1.Add(rdr["sh_desc"]);

}

cmd.Connection.Close();

DataRow myrow = dt.NewRow();

myrow["REF"] = id;

myrow["Description"] = desc;

myrow["QTY"] = quanti;

myrow["Price"] = unitprice;

myrow["Cost"] = cost;

dt.Rows.Add(myrow);

dt.AcceptChanges();

DataGrid2.DataSource = dt;

DataGrid2.DataBind();


}


Please give me some idea where I am lacking.
Thanks in advance!

cheers,
sneha

AnswerRe: unable to update datagrid! Pin
Aman Bhullar14-Jan-09 1:49
Aman Bhullar14-Jan-09 1:49 
QuestionListBox items with check box Pin
anada888613-Jan-09 20:39
anada888613-Jan-09 20:39 
AnswerRe: ListBox items with check box Pin
RajpootRohan13-Jan-09 21:23
professionalRajpootRohan13-Jan-09 21:23 
GeneralRe: ListBox items with check box Pin
Abhijit Jana13-Jan-09 21:44
professionalAbhijit Jana13-Jan-09 21:44 
AnswerRe: ListBox items with check box Pin
Abhijit Jana13-Jan-09 21:43
professionalAbhijit Jana13-Jan-09 21:43 
GeneralRe: ListBox items with check box Pin
anada888613-Jan-09 21:59
anada888613-Jan-09 21:59 
QuestionASP.NET Syntax Highlighting Pin
PhilipPen13-Jan-09 19:13
PhilipPen13-Jan-09 19:13 
QuestionDeploying VB ASP with Crystal Report Pin
saberbladez13-Jan-09 18:13
saberbladez13-Jan-09 18:13 
AnswerRe: Deploying VB ASP with Crystal Report Pin
Aman Bhullar13-Jan-09 20:10
Aman Bhullar13-Jan-09 20:10 
GeneralRe: Deploying VB ASP with Crystal Report Pin
saberbladez14-Jan-09 17:16
saberbladez14-Jan-09 17:16 
QuestionBulk emailng system Pin
Member 236391613-Jan-09 17:13
Member 236391613-Jan-09 17:13 
AnswerRe: Bulk emailng system Pin
Abhijit Jana13-Jan-09 17:23
professionalAbhijit Jana13-Jan-09 17:23 
GeneralRe: Bulk emailng system Pin
Member 236391613-Jan-09 18:02
Member 236391613-Jan-09 18:02 
QuestionProblem with login Control. [modified] Pin
sarang_k13-Jan-09 16:51
sarang_k13-Jan-09 16:51 
AnswerRe: Problem with login Control. Pin
Abhijit Jana13-Jan-09 17:06
professionalAbhijit Jana13-Jan-09 17:06 
AnswerRe: Problem with login Control. Pin
Reza Raad13-Jan-09 17:09
Reza Raad13-Jan-09 17:09 
QuestionConfiguration Error on ASPX Pin
C#Coudou13-Jan-09 15:32
C#Coudou13-Jan-09 15:32 

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.