Dropdown value not changing

Damo1888

New Member
I'm trying to bind my printers name in the dropdown and managed show all the printer name in my dropdown. When I try to get the value of selected item, it show the first value for all the printer. Below is the codeCode to bind the printer name:\[code\]PrintModuleAX printModuleAX = new PrintModuleAX();var result = printModuleAX.GetAllPrinterNames();JObject o = JObject.Parse(result);JArray sizes = (JArray)o["PrinterNames"];var dt = new DataTable();dt.Columns.Add("PrinterValue");dt.Columns.Add("PrinterName");for (int i = 0; i < sizes.Count; i++){ dt.Rows.Add((string)sizes, (string)sizes);}ddlPrinterName.DataSource = dt;ddlPrinterName.DataTextField = dt.Columns["PrinterName"].ToString();ddlPrinterName.DataValueField = dt.Columns["PrinterValue"].ToString();ddlPrinterName.DataBind();\[/code\]code to get the selected value:\[code\]var printername = ddlPrinterName.Text.ToString();var printername1 = ddlPrinterName.SelectedValue.ToString();var printername2 = ddlPrinterName.SelectedItem.ToString();\[/code\]\[code\]printername\[/code\], \[code\]printername1\[/code\], \[code\]printername2\[/code\] show the same value even though I chose a different printer.
 
Back
Top