Click here to Skip to main content
15,899,313 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI,
I have a unicode value save in database table. I want to retrive its original value at runtime and then bind it to the dropdownlist. How to retrive the original value at runtime from unicode form and bind its value to the dropdown.

What I have tried:

SqlCommand cmd = new SqlCommand("Select PSL_RATE , PSL_CURRENCY FROM PSLRATE_MASTER where PSLROLE_ID='" + ddlPSLRoles.SelectedValue + "' and LOCATION_ID= '" + ddlLocations.SelectedValue + "'", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count == 0)
{
ddlPSLRateFormat.Items.Add(new ListItem("//here I want original format value", "U+20B9"));
ddlPSLRateFormat.Items.Add(new ListItem("here I want original format value ", "U+0024"));
ddlPSLRateFormat.Items.Add(new ListItem("here I want original format value ", "U+00A3"));
ddlPSLRateFormat.Items.Add(new ListItem("here I want original format value ", "U+20AC"));
ddlPSLRateFormat.Items.Insert(0, "--Select--");

}
else
{
ddlPSLRateFormat.DataSource = dt;
//here need to convert Unicode value to original form. Unicode format value present in the datacolumn. after converting bind to the below dropdown.

ddlPSLRateFormat.DataTextField = //what should be here;
ddlPSLRateFormat.DataValueField = "PSL_CURRENCY";
ddlPSLRateFormat.DataBind();
}
Posted
Comments
[no name] 5-Feb-16 0:25am    
What value do you have in Database and what is expected result in dropdown.
AnvisNet 5-Feb-16 1:09am    
check how it was encoded and try to decode same way once you got the encoded value back from database

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