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...
-
DROP PROCEDURE IF EXISTS ` test223 `$$ CALL test223 () DELIMITER $$ CREATE DEFINER =` root `@` localhost ` PROCEDURE ` test223 `...
-
< link href =" @ Url.Content( "~/Content/Site.css" )" rel ="stylesheet" type ="text/css...
No comments:
Post a Comment