I need a tutorial (C#) which can show me, how I made a gridview in a web server control (databinding and so on). It has to be a server control not a user control. Anybody who can help me whith a link to such a tutorial?
Kind regards,
simsen


Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Niradhip ChakrabortyPosted Jan 17, 2008, 3:58 PM
check out the following link
1.www.expertrating.com/courseware/DotNetCourse/DotNet-ASP.Net-7-2.asp
2.http://www.dotnetspider.com/kb/Article2109.aspx
3.http://www.dotnetjunkies.com/Tutorial/8D08D5AE-1625-4289-BC9C-BD4BBD4026E4.dcik
U can search more in web.
jatin sharmaPosted Jan 15, 2008, 4:05 AM
example of grid view to show image
.aspx source code:
<
asp:GridView ID="GridView1" Runat="server" DataSource='<%# GetData() %>' AutoGenerateColumns="False" BorderWidth="1px" BackColor="White" CellPadding="3" BorderStyle="None" BorderColor="#CCCCCC" Font-Names="Arial"> <FooterStyle ForeColor="#000066" BackColor="White">FooterStyle> <PagerStyle ForeColor="#000066" HorizontalAlign="Left" BackColor="White">PagerStyle> <HeaderStyle ForeColor="White" Font-Bold="True" BackColor="#006699">HeaderStyle> <Columns> <asp:BoundField HeaderText="Picutre ID" DataField="PictureID"> <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle">ItemStyle> asp:BoundField> <asp:BoundField HeaderText="Title" DataField="Title">asp:BoundField> <asp:BoundField HeaderText="Date Added" DataField="DateAdded" DataFormatString="{0:d}"> <ItemStyle HorizontalAlign="Center">ItemStyle> asp:BoundField> <asp:ImageField DataImageUrlField="PictureURL">asp:ImageField> Columns> <SelectedRowStyle ForeColor="White" Font-Bold="True" BackColor="#669999">SelectedRowStyle> <RowStyle ForeColor="#000066">RowStyle> asp:GridView>.cs code to bind data :
DataTable
GetData(){
// This method creates a DataTable with four rows. Each row has the // following schema: // PictureID int // PictureURL string // Title string // DateAdded datetime DataTable dt = new DataTable(); // define the table's schemadt.Columns.Add(
new DataColumn("PictureID", typeof(int)));dt.Columns.Add(
new DataColumn("PictureURL", typeof(string)));dt.Columns.Add(
new DataColumn("Title", typeof(string)));dt.Columns.Add(
new DataColumn("DateAdded", typeof(DateTime))); // Create the four records DataRow dr = dt.NewRow();dr[
"PictureID"] = 1;dr[
"PictureURL"] = ResolveUrl("~/DisplayingImages/Images/Blue hills.jpg");dr[
"Title"] = "Blue Hills";dr[
"DateAdded"] = new DateTime(2005, 1, 15);dt.Rows.Add(dr);
dr = dt.NewRow();
dr[
"PictureID"] = 2;dr[
"PictureURL"] = ResolveUrl("~/DisplayingImages/Images/Sunset.jpg");dr[
"Title"] = "Sunset";dr[
"DateAdded"] = new DateTime(2005, 1, 21);dt.Rows.Add(dr);
dr = dt.NewRow();
dr[
"PictureID"] = 3;dr[
"PictureURL"] = ResolveUrl("~/DisplayingImages/Images/Water lilies.jpg");dr[
"Title"] = "Water Lilies";dr[
"DateAdded"] = new DateTime(2005, 2, 1);dt.Rows.Add(dr);
dr = dt.NewRow();
dr[
"PictureID"] = 4;dr[
"PictureURL"] = ResolveUrl("~/DisplayingImages/Images/Winter.jpg");dr[
"Title"] = "Winter";dr[
"DateAdded"] = new DateTime(2005, 2, 18);dt.Rows.Add(dr);
return dt;}
void Page_Load(object sender, EventArgs e){
Page.DataBind();
}
hope this will help u..!