Friday, 9 December 2011

Asp.net GriView Control and Asp.net SqlDataSourec Control used to display records from Database


  <div align="center">
      <asp:GridView ID="ExencoGrid" runat="server" AllowPaging="True" AllowSorting="True"
     AutoGenerateColumns="False" DataKeyNames="pk"
     DataSourceID="ExencoDataSource"
     EmptyDataText="Currently No Jobs are available.">
   
         
<Columns>
    <asp:CommandField ShowDeleteButton="false" ShowEditButton="false" />
<asp:BoundField DataField="Job_Title"    HeaderText="Job_Title"  SortExpression="Job_Title" />
    <asp:BoundField DataField="Job_Description" HeaderText="Job_Description"   SortExpression="Job_Description"  />
<asp:BoundField DataField="Experience_Required" HeaderText="Exprience_Required"   SortExpression="Exprience_Required"  />
<asp:BoundField DataField="Skills_Required" HeaderText="Skills_Required"   SortExpression="Skills_Required"  />
<asp:BoundField DataField="pk" HeaderText="ppk"   SortExpression="ppk"  />
</Columns>

  </asp:GridView>
       
  <asp:SqlDataSource ID="ExencoDataSource" runat="server"
   ConnectionString="server=mssql2008-1;database=Tahir_2;user id=tahir; password=khalid"
  SelectCommand="SELECT [Job_Title],[Job_Description],[Experience_Required],[Skills_Required],[pk] FROM [JobTable]"          >
 </asp:SqlDataSource>
   
    </div>

No comments:

Post a Comment