i have table student with 5 columns that is student_id,student_name,student_class,student_gender,student_position, i only want show 3 columns that is student_name,student_class ,student_position i use this query
select student_name,student_class ,student_position from student,the issue is whenever i come to load my gridview i got the rest two columns what will i do to hide the
have tried this but not working
gdvstudent.Columns[1].Visible=false;
but not working ,anybody with idea help please using asp.net c#

Bhuvanesh MohankumarRank #310 · 8.1K reputationPosted May 12, 2016, 5:09 AM EDT
You should make the "Auto Generate Column" option in grid to false, so what ever you specify only those columns will be displayed in grid view.
Carlos kambuiRank #2,642 · 528 reputationPosted May 12, 2016, 5:46 AM EDT
Bhuvanesh MohankumarRank #310 · 8.1K reputationPosted May 12, 2016, 5:52 AM EDT
Hi Carlos,
You are binding the data to the grid using databind in code behind .aspx.cs file,
Carlos kambuiRank #2,642 · 528 reputationPosted May 12, 2016, 6:00 AM EDT
Carlos kambuiRank #2,642 · 528 reputationPosted May 12, 2016, 6:01 AM EDT
Bhuvanesh MohankumarRank #310 · 8.1K reputationPosted May 12, 2016, 8:36 AM EDT
Carlos kambuiRank #2,642 · 528 reputationPosted May 12, 2016, 11:05 PM EDT
Bhuvanesh MohankumarRank #310 · 8.1K reputationPosted May 13, 2016, 12:04 AM EDT
Yes, you can use.