Nirmal KumarC

Nirmal KumarC

  • 1.4k
  • 327
  • 78.6k

How to Dropdown Value distict particular one column distinct

Nov 6 2014 3:58 AM
iMy Source Wise Gridview Dropdown More Time Display How to Solve this Problem,

My Source is:
private void LoadAdjustLeave()
{
SqlCommand cmd = new SqlCommand();
SqlDataAdapter da;
cmd.Connection = con;
cmd.CommandType = CommandType.Text;
try
{
//string sql = " select USER_ID as UserID, LateDays,Leave,Remainingminutes,Month,Year from Accounts_LateEntry_Salary_Deduct where User_ID='" + gvStaffDetails.SelectedRow.Cells[2].Text.ToString().Trim() + "'";
string sql = "select convert(VARCHAR(12),LeaveDate) as leavedate, InformType, TotalDays, Leave,Applyhrs from deletetable where UserID='" + gvStaffDetails.SelectedRow.Cells[2].Text.ToString().Trim() + "' and Month='" + Session["paymonth"] + "' and Year='" + Session["payyear"] + "'";
da = new SqlDataAdapter(sql, con);
//DataSet ds = new DataSet();
DataTable dt = new DataTable();
da.Fill(dt);
con.Open();
gvadjustleave.DataSource = dt;
Session["AdjustLeave"] = dt;
gvadjustleave.DataBind();
con.Close();

}
catch (Exception Ex1)
{
LblErr.Text = Ex1.Message.ToString();
return;
}
}
I want Dropdown Data(Distinct)  Load This Result  
Prior
Late informed
Not Informed