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 is clr? How does work clr & wht is work of clr?

0 Answers  


what are background threads? give ex?

3 Answers   CSC, Kanbay,


what is use of entity container?

0 Answers   Microsoft,


What symbol would you use to denote, the start of a code block in razor views?

0 Answers  


Explain the difference between viewbag and viewdata in mvc?

0 Answers  


what is the three pillar of .Net ?

11 Answers  


Which are the important namespaces used in ASP.Net MVC?

0 Answers  


Hi my name is sahil. i did my bsc in 2008 n did marketing jobs thereafter. bt nw i wanna learn .net to enter IT field. Ive heard deccansoft,secbad is the best inst. for .net. bt do they provide placement?? as im not a fresher so will i be hired by any company..??

1 Answers  


How do you register the dotnet component or assembly ?

1 Answers   Accenture, BirlaSoft,


What is Partial Assembly References?

3 Answers   Microsoft,


what is a mvc in asp.net?

3 Answers   Cap Gemini, Elsinoir Technologies, HCL,


Difference between manifest , metadata?

3 Answers   Soma Technology, TCS,


Categories