Crstel report based on the dropdownlist
hi Frnds...i want to generate crystal report to display itemcode ,batch no, expiry date based on t location and itemcode. I get Location and Item code in dropdownlist...Any1 help me plz...its very urgent....
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
sathish kumarPosted May 15, 2012, 5:23 AM
Kunal VaishyaPosted May 15, 2012, 5:02 AM
Fill dataset with any table like Code and Name
after
Set DataSource into DropDown Like this
private void FillDropDownList()
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnString"].ConnectionString);
SqlCommand cmd = new SqlCommand("Select * from students", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
DropDownList1.DataTextField = ds.Tables[0].Columns["FullName"].ToString();
DropDownList1.DataValueField = ds.Tables[0].Columns["id"].ToString();
DropDownList1.DataSource = ds.Tables[0];
DropDownList1.DataBind();
}