Click here to Skip to main content
15,894,343 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
By using Container.DataItem, how to bind data from database?
Posted
Updated 7-Apr-11 21:03pm
v2

try this link

Click[^]
 
Share this answer
 
once the query is executed in database side u get the records using data adaper. once fill the adapter records into dataset. dataset must has the records in the form of rows and columns. finally attach the datasource of the control with dataset. Then Datas will bind into the control

Ex:
Gridview1.datatsource = ds;
Gridview.DataBind()
 
Share this answer
 
You need to do

<br />
 < ((Customer)Container.DataItem).CustomerID.ToString(); ><br />


And to bind datasouce

MIDL
Gridview1.datatsource = ds;
Gridview.DataBind()
 
Share this answer
 
SqlConnection con = new SqlConnection("Connection String");
SqlDataAdapter adp = new SqlDataAdapter("sqlquery",con);
DataSet ds = new DataSet();
adp.Fill(ds);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900