By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,044 Members | 1,287 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,044 IT Pros & Developers. It's quick & easy.

grid with new link using C#

100+
P: 115
Hi

i have one doubt abt datagrid (using c#). pls help me

here is my code

//** code start here**

Page_Load event:

DataSet ds = BuildDataSet();
DataGrid1.DataSource = ds;
DataGrid1.DataBind();

private DataSet BuildDataSet(){ DataSet ret = new DataSet(); DataTable dt =
new DataTable(); DataRow dr = null; // Define table column names and datatypes DataColumn dc =
new DataColumn("ID",Type.GetType("System.Int32")); dt.Columns.Add(dc); dc = new DataColumn("Name",Type.GetType("System.String"));
dt.Columns.Add(dc); dc = new DataColumn("Date",Type.GetType("System.DateTime")) ; dt.Columns.Add(dc); // Fill the table with sample data
for(int i = 1;i < = 10;i++) { dr = dt.NewRow(); dr["ID"] = i; dr["Name"] = "John Smith";
dr["Date"] = DateTime.Now.AddSeconds(i * 10); dt.Rows.Add(dr); } // Return the dataset to the caller ret.Tables.Add(dt);
return ret;}
//**** code end here**
here i have add one more column with link . how can i add?

pls help me. pls send code immd
am waiting for ur reply
i want to be utput looks like this

ID Name Date URL
1 John Smith 1/1/2007 Hyper Link

2 John Smith 2/2/2007 Hyper Link
Apr 25 '07 #1
Share this Question
Share on Google+
6 Replies


100+
P: 115
Hi Mercie

i have one doubt abt datagrid (using c#). pls help me

here is my code

//** code start here**

Page_Load event:

DataSet ds = BuildDataSet();
DataGrid1.DataSource = ds;
DataGrid1.DataBind();

private DataSet BuildDataSet(){ DataSet ret = new DataSet(); DataTable dt =
new DataTable(); DataRow dr = null; // Define table column names and datatypes DataColumn dc =
new DataColumn("ID",Type.GetType("System.Int32")); dt.Columns.Add(dc); dc = new DataColumn("Name",Type.GetType("System.String"));
dt.Columns.Add(dc); dc = new DataColumn("Date",Type.GetType("System.DateTime")) ; dt.Columns.Add(dc); // Fill the table with sample data
for(int i = 1;i < = 10;i++) { dr = dt.NewRow(); dr["ID"] = i; dr["Name"] = "John Smith";
dr["Date"] = DateTime.Now.AddSeconds(i * 10); dt.Rows.Add(dr); } // Return the dataset to the caller ret.Tables.Add(dt);
return ret;}
//**** code end here**
here i have add one more column with link . how can i add?

pls help me. pls send code immd
am waiting for ur reply
i want to be utput looks like this

ID Name Date URL
1 John Smith 1/1/2007 Hyper Link

2 John Smith 2/2/2007 Hyper Link
Apr 25 '07 #2

100+
P: 115
Hi
i have one doubt abt datagrid (using c#). pls help me

here is my code

//** code start here**

Page_Load event:

DataSet ds = BuildDataSet();
DataGrid1.DataSource = ds;
DataGrid1.DataBind();

private DataSet BuildDataSet(){ DataSet ret = new DataSet(); DataTable dt =
new DataTable(); DataRow dr = null; // Define table column names and datatypes DataColumn dc =
new DataColumn("ID",Type.GetType("System.Int32")); dt.Columns.Add(dc); dc = new DataColumn("Name",Type.GetType("System.String"));
dt.Columns.Add(dc); dc = new DataColumn("Date",Type.GetType("System.DateTime")) ; dt.Columns.Add(dc); // Fill the table with sample data
for(int i = 1;i < = 10;i++) { dr = dt.NewRow(); dr["ID"] = i; dr["Name"] = "John Smith";
dr["Date"] = DateTime.Now.AddSeconds(i * 10); dt.Rows.Add(dr); } // Return the dataset to the caller ret.Tables.Add(dt);
return ret;}
//**** code end here**
here i have add one more column with link . how can i add?

pls help me. pls send code immd
am waiting for ur reply
i want to be utput looks like this

ID Name Date URL
1 John Smith 1/1/2007 Hyper Link

2 John Smith 2/2/2007 Hyper Link
Apr 25 '07 #3

Motoma
Expert 2.5K+
P: 3,235
Please do not double (triple) post!
Apr 25 '07 #4

100+
P: 366
Hello

If you want to add some special columns like button or link in datagrid you have to use template column for that,you can edit that template column and you can place any control as for your need,

try it out....
Apr 26 '07 #5

100+
P: 115
how ?

pls give me some samples.

i am add link colum through programmatically

pls do it needful
Apr 26 '07 #6

100+
P: 115
Sir
please help me
please give me some samples
it is very urgent
May 2 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.