C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » ASP.NET »

datagrid


Posted Date: 09 Jan 2009      Posted By: ramalingam      Member Level: Bronze     Points: 1   Responses: 4



i am new bee in datagrid...

i want display data within datagrid

]can anyone help me....





Responses

Author: Pascal    09 Jan 2009Member Level: GoldRating: 2 out of 52 out of 5     Points: 4

Here is the simple code.. Need to change the SqlDataSource accordingly.

<asp:DataGrid ID="dg1" runat="server" DataSourceID="SqlDataSource1">
</asp:DataGrid>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:StarTekConnectionString1 %>"
ProviderName="<%$ ConnectionStrings:StarTekConnectionString1.ProviderName %>"
SelectCommand="SELECT [EmpId], [StartDate], [EndDate], [ShiftLogic], [ShiftType] FROM [AAAEmp_Details]">
</asp:SqlDataSource>



Author: Abhinav Misra    09 Jan 2009Member Level: SilverRating: 2 out of 52 out of 5     Points: 3

by default datagrid control is not shown in
toll box of vs2005 and vs2008\
you have to add dll for that
follow these step
1.go to you solution explorer
2.right click
3.click on add reference and select .net component
4.add datagrid dll

and then bound your datagrid control to the database table
using property of datagrid as

1>data source
2>data bound



Author: Syed Shakeer Hussain     09 Jan 2009Member Level: DiamondRating: 2 out of 52 out of 5     Points: 3

Hi

How to display data in DataGrid using DataSet

SqlConnection conn=new SqlConnection("your connection string");
conn.Open();
SqlDataAdapter adapter=new SqlDataAdapter("select * from emp",conn);
SqlCommandBuilder builder=new SqlCommandBuilder(adapter);
DataSet ds=new DataSet();
adapter.Fill(ds,"emp");
Datagrid1.DataSource=ds.Tabales["emp"];

Happy Coding....


Thanks & Regards!
Syed Shakeer Hussain



Author: Venkat    10 Jan 2009Member Level: BronzeRating: 2 out of 52 out of 5     Points: 1

Hai
U Can Bind the Grid by So many Ways .By Using Datasources and With the help of DataSet And Datareader Also.Better to Go Thru DataReader



Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.


Next : creating setup file
Previous : slow browsing
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use