<asp:GridView ID="gv" Runat="Server"
AutoGenerateColumns="true"
BorderColor="#000080"
BorderWidth="2px"
HorizontalAlign="Center"
Width="90%" >
</asp:GridView>
codebehind file/////////
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
SqlDataSource Source= new SqlDataSource();
Source.ConnectionString = ConfigurationManager.
ConnectionStrings["ConnectionString"].ConnectionString;
Source.DataSourceMode = SqlDataSourceMode.DataReader;
Source.ProviderName = "System.Data.SqlClient";
Source.SelectCommand = "SELECT companyname, companyaddress, companycity FROM companydetail ORDER BY companyname";
gv.DataSource = Source;
gv.DataBind();
}
}
No comments :
Post a Comment