How to bind table coloum with gridview column

Answers were Sorted based on User's Feedback



How to bind table coloum with gridview column..

Answer / eyesice

DataTable dt = new DataTable("Sample");
DataColumn dc;

dc = new DataColumn("ID");
dc.DataType = System.Type.GetType("System.Int32");
dt.Columns.Add(dc);

dc = new DataColumn("Name");
dc.DataType = System.Type.GetType("System.String");
dt.Columns.Add(dc);

dataGridView1.DataSource = dt;

Is This Answer Correct ?    4 Yes 0 No

How to bind table coloum with gridview column..

Answer / srinu.dotnetspider

hi friends, How to bind table coloum with gridview column>

i have 1 table and gridview, in that table eventype is one
of the column .

eventype
---------
2
4
5
6

now my requirement is eventype =1 then change gridview column
and also some msg like programer is logged in..etc

Is This Answer Correct ?    2 Yes 4 No

How to bind table coloum with gridview column..

Answer / amit

hi,
you use gridview content click event, in this you do like that

if (dgvCustomers.CurrentRow.Index != -1)
{
if (dgvCustomers.CurrentCell.OwningColumn.Name == "eventype")
if (Convert.ToString(dgvCustomers.CurrentCell.Value) ==
"1")
{ msgbox.show("Hello World ..."); }
}
else
{
MessageBox.Show("Hi its amit" );
}

Is This Answer Correct ?    3 Yes 7 No

Post New Answer

More Dot Net Framework Interview Questions

What's the .NET class that allows the retrieval of a data element using a unique key

1 Answers  


What is the use of web api ? Why web api needed, if you have already restful services using wcf ?

0 Answers  


What are the mobile devices supported by .net platform

1 Answers  


Difference between .NET & J2EE

1 Answers  


What are the new features 3.5 framework against with the tool?

0 Answers  






How Garbage Collector identifies the objects which are not in use?

6 Answers   EXL, Honeywell, Microsoft, Tech Mahindra, Tesco,


Is dapper better than entity framework?

0 Answers  


How to answer for project questions..?

0 Answers  


Please explain me what the project manager will ask in the interview.The interview is for senior position in .Net (5 years experience )

0 Answers   NNN,


what is client wins and store wins mode in entity framework concurrency?

0 Answers   Microsoft,


What is edm (entity data model)? : Entity framework

0 Answers  


What are attributes

1 Answers  


Categories