Follow by Email

Tuesday, 14 August 2012

Bind different column values of dataset table to a dropdownlist in asp.net

Bind different column values of dataset table to a dropdownlist in asp.net


private void fill_cardDropDown()
{
OleDbDataAdapter Oda3 = new OleDbDataAdapter();
DataSet ds3 = new DataSet();
Oda3.Fill(ds3, rsPaymentTerm, "MyTable");
while (rowCount < ds3.Tables[0].Rows.Count)
{

if (ds3.Tables[0].Rows[rowCount]["SERVICE"].ToString() != "")
{
val1 = ds3.Tables[0].Rows[rowCount]["SERVICE"].ToString();
}
else
{
val1 = "0" + "*" + ds3.Tables[0].Rows[rowCount]["REAL_TIME"].ToString() + "*";
}

string val3 = ds3.Tables[0].Rows[rowCount]["PT_TYPE"].ToString() + "*" + ds3.Tables[0].Rows[rowCount]["METHOD_CODE"].ToString() + "*" + ds3.Tables[0].Rows[rowCount]["TERM_TYPE"].ToString() + "*" + ds3.Tables[0].Rows[rowCount]["ORDER_TERM_CODE"].ToString() + "*0*0*0*0*0*0*0" + ds3.Tables[0].Rows[rowCount]["SHIPPAGE_TERM_DESC"].ToString();
//ddl_payUsing.DataTextField=ds3.Tables[0].Columns["PT_TYPE"].ToString() + "*" + ds3.Tables[0].Columns["METHOD_CODE"].ToString() + "*" + ds3.Tables[0].Columns["TERM_TYPE"].ToString() + "*" + ds3.Tables[0].Columns["ORDER_TERM_CODE"].ToString()+"*0*0*0*0*0*0*0"+ds3.Tables[0].Columns["SHIPPAGE_TERM_DESC"].ToString();
ddl_payUsing.Items.Add(new ListItem(ds3.Tables[0].Rows[rowCount]["SHIPPAGE_TERM_DESC"].ToString(), val3));

rowCount++;
}
}
}

0 comments:

Post a Comment


                                                            

 
Design by Abhinav Ranjan Sinha