XML : Checkboxlist selected Item saves only one item

I have a checkboxlist, and If I select 2 items what happens here is it only saves the first Item selected.

How to save both the items.

Here is what I tried.

  <asp:CheckBoxList ID="ddlStatus" name="ddlStatus" runat="server" AutoPostBack="true"                      OnSelectedIndexChanged="ddlStatus_SelectedIndexChanged">                  </asp:CheckBoxList>    

Saving code:-

  StringBuilder sb = new StringBuilder();      XmlWriter xw = XmlWriter.Create(sb);        xw.WriteStartElement("DocumentElement");      {          xw.WriteStartElement("XXCUS.XXACL_PN_AGRMNT_MST");          xw.WriteElementString("STATUS", ddlStatus.SelectedValue);      }      xw.WriteEndElement();      xw.Close();      try      {          MainEnqMkey = InsertUpdateDelete.InsertUpdateDeleteCls.InsertUpdateDelete_oracle(HidMode.Value, Convert.ToInt32(HidMKey.Value), "XXCUS.XXACL_PN_AGRMNT_MST", "MKEY", "AM", sb.ToString());          if (Request.QueryString["Mode"] != "M")          {              ObjPriCon.Open();              OracleCommand ObjPriCmd_seq2 = new OracleCommand("select XXCUS.XXACL_PN_AGRMNT_MST_SEQ.nextval from dual", ObjPriCon); // generating ref no here.              string strRefNo = Convert.ToString(ObjPriCmd_seq2.ExecuteOracleScalar());                Response.Write("<script language=javascript> alert('Your Document No is : " + strRefNo.ToString() + "')</script>");              OracleCommand cmd2 = new OracleCommand("Update XXCUS.XXACL_PN_AGRMNT_MST set DOC_NO = '" + strRefNo.ToString() + "' where MKEY = '" + MainEnqMkey + "'", ObjPriCon); // Updating ref no here              cmd2.ExecuteNonQuery();              ObjPriCon.Close();          }          ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('Record Saved Successfully');window.location ='Frm_Agreement_Master.aspx?TranType=AM&PView=N&Mode=A&Redirect=oracle&Key=0&Redirect=" + Request.QueryString["Redirect"] + "&userid=" + Request.QueryString["userid"].ToString() + "';", true);      }    

No comments:

Post a Comment