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...
-
DROP PROCEDURE IF EXISTS ` test223 `$$ CALL test223 () DELIMITER $$ CREATE DEFINER =` root `@` localhost ` PROCEDURE ` test223 `...
-
string float_value="234.4567"; //If data come from databse then first convert it into string then this line; float fl=float.pars...
-
Kendo UI Uploader : Create a kendo ui uploader control in MVC View @( Html.Kendo().Upload() .Name( "fi...
No comments:
Post a Comment