title: How to save the name of dropdownlist instead of its ID?
body: <p>I m been working on a project in which i m facing an issue 
  I m having two drop down list which are Select category (ddlcategory) and select subcategory (ddlsubcategory) here are they
  <a href="https://i.stack.imgur.com/AiXn0.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AiXn0.jpg" alt="Image of the drop down list"></a></p>
  
  <p>When I'm saving the data i m getting the ID saved into my database instead of category name and subcategory name Here is my database values :
  <a href="https://i.stack.imgur.com/iv3vq.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iv3vq.jpg" alt="Image of stored values that is Id of which i want to store the name "></a>
  Here is my back code i have implemented :</p>
  
  <pre><code> String constr = @"Data Source=.\SQLEXPRESS;AttachDbFilename=D:\PROJECT SEM6\Online Tours and Travels\App_Data\ToursandTravels.mdf;Integrated Security=True;User Instance=True";
  string query = "";
  protected void Page_Load(object sender, EventArgs e)
  {
      if (!IsPostBack)
      {
          BindCategoryDropdown();
      }
  }
  protected void btnpreviewwebsite_Click1(object sender, EventArgs e)
  {
      Response.Redirect("http://localhost:50550/Online Tours and Travels/index.aspx");
  }
  protected void btnlogout_Click(object sender, EventArgs e)
  {
      Session.Abandon();
      Session.Clear();
      Response.Redirect("http://localhost:50550/Online Tours and Travels/Admin Panel/LoginForm.aspx");
  
  }
  protected void BindCategoryDropdown()
  {
      //conenction path for database
      SqlConnection con = new SqlConnection(constr);
      con.Open();
      SqlCommand cmd = new SqlCommand("select * from category", con);
      SqlDataAdapter da = new SqlDataAdapter(cmd);
      DataSet ds = new DataSet();
      da.Fill(ds);
      con.Close();
      ddlcategory.DataSource = ds;
      ddlcategory.DataTextField = "Cat_name";
      ddlcategory.DataValueField = "Cat_id";
      ddlcategory.DataBind();
      ddlcategory.Items.Insert(0, new ListItem("--Select--", "0"));
      ddlsubcategory.Items.Insert(0, new ListItem("--Select--", "0"));
  }
  
  protected void ddlcategory_SelectedIndexChanged(object sender, EventArgs e)
  {
      int categoryid = Convert.ToInt32(ddlcategory.SelectedValue);
      SqlConnection con = new SqlConnection(constr);
      con.Open();
      SqlCommand cmd = new SqlCommand("select * from subcategory where catid=" + categoryid, con);
      SqlDataAdapter da = new SqlDataAdapter(cmd);
      DataSet ds = new DataSet();
      da.Fill(ds);
      con.Close();
      ddlsubcategory.DataSource = ds;
      ddlsubcategory.DataTextField = "subcatname";
      ddlsubcategory.DataValueField = "subcatid";
      ddlsubcategory.DataBind();
      ddlsubcategory.Items.Insert(0, new ListItem("--Select--", "0"));
  
  }
  protected void btnsave_Click(object sender, EventArgs e)
  {
      SqlConnection con = new SqlConnection(constr);
      String pathName1 = "~/packageimages/" + Path.GetFileName(fileuploadpic1.PostedFile.FileName);
      String pathName2 = "~/packageimages/" + Path.GetFileName(fileuploadpic2.PostedFile.FileName);
      String pathName3 = "~/packageimages/" + Path.GetFileName(fileuploadpic3.PostedFile.FileName);
      query = 
      "insert into package(packname,catid,categoryname,subcatname,packageprice,pic1,pic2,pic3,detail) values('"+txtpackagename.Text+"','"+txtcategoryid.Text+"','"+ddlcategory.Text+"','"+ddlsubcategory.Text+"','"+txtpackageprice.Text+"','"+pathName1+"','"+pathName2+"','"+pathName3+"','"+txtdetails.Text+"') ";
      SqlCommand cmd = new SqlCommand(query, con);
      con.Open();
      cmd.ExecuteNonQuery();
      con.Close();
      fileuploadpic1.SaveAs(Server.MapPath("~/packageimages/" + fileuploadpic1.FileName));
      fileuploadpic2.SaveAs(Server.MapPath("~/packageimages/" + fileuploadpic2.FileName));
      fileuploadpic2.SaveAs(Server.MapPath("~/packageimages/" + fileuploadpic3.FileName));
      txtpackagename.Text = "";
      txtcategoryid.Text = "";
      txtpackageprice.Text = "";
      txtdetails.Text = "";
      string message = "Package Added !!";
      System.Text.StringBuilder sb = new System.Text.StringBuilder();
      sb.Append("&lt;script type = 'text/javascript'&gt;");
      sb.Append("window.onload=function(){");
      sb.Append("alert('");
      sb.Append(message);
      sb.Append("')};");
      sb.Append("&lt;/script&gt;");
      ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", sb.ToString());
  }
  </code></pre>
  
  <p>Please do help ! Thank You </p>