SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["abc"].ToString());
protected void Page_Load(object sender, EventArgs e)
{
con.Open();
string query = "select * from FilterGridViewBySection ";
SqlCommand cmd = new SqlCommand(query, con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
DropDownList1.DataSource = ds;
DropDownList1.DataTextField = "bid";
DropDownList1.DataBind();
//this line create a new item and set it at 0 index position
DropDownList1.Items.Insert(0, new ListItem("Select", "select"));
}
This is a open code forum with some good code which makes you help to solve your coding problem.
Subscribe to:
Post Comments (Atom)
SQL Optimization
SQL Optimization 1. Add where on your query 2. If you remove some data after the data return then remove the remove condition in the sel...
-
Kendo UI Uploader : Create a kendo ui uploader control in MVC View @( Html.Kendo().Upload() .Name( "fi...
-
string float_value="234.4567"; //If data come from databse then first convert it into string then this line; float fl=float.pars...
-
We are bind dynamic columns and there values as a rows to Kendo UI grid, To do this we are using a Json file as a data and column list. ...
No comments:
Post a Comment