Click here to Skip to main content
15,312,009 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
DropDownList ddlist = (DropDownList)dr.Cells[(int)profoptgridcol.value].FindControl("ddlValue");
                                    if (ddlist.Visible && ddlist != null)
                                       userprofoptdt.Rows[actualrowidx][(int)profoptgridsrccol.selvalue] = Convert.ToString(ddlist.SelectedValue);

so my req is,if i select blank in dropdown list(ddlist),it should accept balnk and store as null in db.

current functionality: if i select blank in ddlist and save its showing previous val in ddlist and in db.

ddlvalue=dropdownlist ctrl

profoptgridcol is a enum:
enum profoptgridcol : int
            optiondesc = 0, defvaluedescr, curvaldescr, value, useroptionval, optname, valuelist, optionid
Updated 17-Feb-15 18:53pm

Based on the description it sounds that you're storing the value from some other variable, datatable etc and that it's not properly synced with the selection of the drop down list.

Without seeing all the relevant code, the best advice is to use the debugger to go through the code and see where the mismatch is.

When saving to the database make sure that you use DBNull.Value for blank selection and store that value into the table via a OracleParameter.
In your command parameters, try cmd.Parameters.Add("column", "Null");

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